diff --git a/MethodDecorator.Fody/MethodDecorator.cs b/MethodDecorator.Fody/MethodDecorator.cs index 74680d1e..bf8db195 100644 --- a/MethodDecorator.Fody/MethodDecorator.cs +++ b/MethodDecorator.Fody/MethodDecorator.cs @@ -18,7 +18,6 @@ public MethodDecorator(ModuleDefinition moduleDefinition) { public void Decorate(TypeDefinition type, MethodDefinition method, CustomAttribute attribute, bool explicitMatch) { - method.Body.InitLocals = true; var methodBaseTypeRef = this._referenceFinder.GetTypeReference(typeof(MethodBase)); @@ -182,8 +181,13 @@ public void Decorate(TypeDefinition type, MethodDefinition method, CustomAttribu processor.InsertBefore(methodBodyFirstInstruction, bypassInstructions); if (callOnEntryInstructions != null) + { processor.InsertBefore(methodBodyFirstInstruction, callOnEntryInstructions); + if (bypassInstructions != null) + processor.InsertBefore(methodBodyFirstInstruction, bypassInstructions); + } + if (methodBodyReturnInstructions != null) { processor.InsertAfter(method.Body.Instructions.Last(), methodBodyReturnInstructions); diff --git a/MethodDecoratorInterfaces/IPartialDecorator.cs b/MethodDecoratorInterfaces/IPartialDecorator.cs index 5a410907..1edd7e4d 100644 --- a/MethodDecoratorInterfaces/IPartialDecorator.cs +++ b/MethodDecoratorInterfaces/IPartialDecorator.cs @@ -32,15 +32,15 @@ public interface IPartialDecoratorException { void OnException(Exception iException); } - interface IPartialDecoratorContinuation + public interface IPartialDecoratorContinuation { void OnTaskContinuation(Task task); } - interface IPartialDecoratorNeedBypass + public interface IPartialDecoratorNeedBypass { bool NeedBypass(); } - interface IPartialAlterRetval + public interface IPartialAlterRetval { object AlterRetval(object iRetval); }