From 23fe284b4888ba12929d7508a2a8651a39683a91 Mon Sep 17 00:00:00 2001 From: halit tiryaki Date: Thu, 26 Oct 2017 17:01:36 +0200 Subject: [PATCH 1/2] interrupt already supported by NeedBypass() method signature. only added an additional check after OnEnter() invoke. --- MethodDecorator.Fody/MethodDecorator.cs | 6 +++++- MethodDecoratorInterfaces/IPartialDecorator.cs | 6 +++--- MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) 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); } diff --git a/MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj b/MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj index d8f03216..48b21f87 100644 --- a/MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj +++ b/MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj @@ -41,6 +41,7 @@ + From 10cd02260aa5e119b00c8caa91519d9cf91a8fca Mon Sep 17 00:00:00 2001 From: halit tiryaki Date: Thu, 26 Oct 2017 17:27:30 +0200 Subject: [PATCH 2/2] removed IInterruptableMethodDecorator.cs --- MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj b/MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj index 48b21f87..d8f03216 100644 --- a/MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj +++ b/MethodDecoratorInterfaces/MethodDecoratorInterfaces.csproj @@ -41,7 +41,6 @@ -