private void WeaveInterceptionCall( MethodDefinition methodToExtend, MethodDefinition decoratedMethodParameter, MethodDefinition implementationMethodParameter, FieldDefinition interceptorManager) { methodToExtend.Body.InitLocals = true; ILProcessor processor = methodToExtend.Body.GetILProcessor(); processor.Emit(OpCodes.Nop); var decoratedMethodVar = methodToExtend.AddVariableDefinition("__fody$originalMethod", this.methodBaseTypeRef); var implementationMethodVar = methodToExtend.AddVariableDefinition("__fody$implementationMethod", this.methodBaseTypeRef); var parametersVar = methodToExtend.AddVariableDefinition("__fody$parameters", this.objectArrayTypeRef); this.SaveMethodBaseToVariable(processor, decoratedMethodParameter, decoratedMethodVar); if (implementationMethodParameter != null) { this.SaveMethodBaseToVariable(processor, implementationMethodParameter, implementationMethodVar); } processor.SaveParametersToNewObjectArray(parametersVar, methodToExtend.Parameters.ToArray()); this.CallInterceptMethod(interceptorManager, processor, decoratedMethodVar, implementationMethodVar, parametersVar); HandleInterceptReturnValue(methodToExtend, processor); // write method end processor.Emit(OpCodes.Ret); methodToExtend.Body.OptimizeMacros(); }