You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two advices in ClassLibrary1: GenericAdvice<TReturn> and NonGenericAdvice, when building finished, the NonGenericAdvice works as intended, but GenericAdvice<TReturn> only works in the same project as the advice .
namespaceClassLibrary1{publicclassMyClass2{[GenericAdvice<List<int>>]publicTask<int>Method1(){// ISSUE: method reference// ISSUE: method reference// ISSUE: method referencereturn(Task<int>) ⚡Invocation.ProceedAspect((object)this,__methodref(MyClass2.Method1),__methodref(MyClass2.Method1′),__methodref(MyClass2.Method1″));}[NonGenericAdvice]publicTask<int>Method2(){// ISSUE: method reference// ISSUE: method reference// ISSUE: method referencereturn(Task<int>) ⚡Invocation.ProceedAspect((object)this,__methodref(MyClass2.Method2),__methodref(MyClass2.Method2′),__methodref(MyClass2.Method2″));}[ExecutionPoint]privateTask<int>Method1′(){// ISSUE: object of a compiler-generated type is created// ISSUE: variable of a compiler-generated typeMyClass2.<Method1>d__0 stateMachine =new MyClass2.<Method1>d__0();// ISSUE: reference to a compiler-generated fieldstateMachine.<>t__builder=AsyncTaskMethodBuilder<int>.Create();// ISSUE: reference to a compiler-generated fieldstateMachine.<>4__this=this;// ISSUE: reference to a compiler-generated fieldstateMachine.<>1__state=-1;// ISSUE: reference to a compiler-generated fieldstateMachine.<>t__builder.Start<MyClass2.<Method1>d__0>(refstateMachine);// ISSUE: reference to a compiler-generated fieldreturnstateMachine.<>t__builder.Task;}privatestaticobjectMethod1″([In]objectobj0,[In]object[]obj1){return(object)((MyClass2)obj0).Method1′();}[ExecutionPoint]privateTask<int>Method2′(){// ISSUE: object of a compiler-generated type is created// ISSUE: variable of a compiler-generated typeMyClass2.<Method2>d__1 stateMachine =new MyClass2.<Method2>d__1();// ISSUE: reference to a compiler-generated fieldstateMachine.<>t__builder=AsyncTaskMethodBuilder<int>.Create();// ISSUE: reference to a compiler-generated fieldstateMachine.<>4__this=this;// ISSUE: reference to a compiler-generated fieldstateMachine.<>1__state=-1;// ISSUE: reference to a compiler-generated fieldstateMachine.<>t__builder.Start<MyClass2.<Method2>d__1>(refstateMachine);// ISSUE: reference to a compiler-generated fieldreturnstateMachine.<>t__builder.Task;}privatestaticobjectMethod2″([In]objectobj0,[In]object[]obj1){return(object)((MyClass2)obj0).Method2′();}}}
Class in different project not work:
publicclassMyClass1{publicasyncTask<int>Method1(){awaitTask.Delay(1);// <----- not weavedreturn1;}[NonGenericAdvice]publicTask<int>Method2(){// ISSUE: method reference// ISSUE: method reference// ISSUE: method referencereturn(Task<int>) ⚡Invocation.ProceedAspect((object)this,__methodref(MyClass1.Method2),__methodref(MyClass1.Method2′),__methodref(MyClass1.Method2″));}[ExecutionPoint]privateTask<int>Method2′(){// ISSUE: object of a compiler-generated type is created// ISSUE: variable of a compiler-generated typeMyClass1.<Method2>d__1 stateMachine =new MyClass1.<Method2>d__1();// ISSUE: reference to a compiler-generated fieldstateMachine.<>t__builder=AsyncTaskMethodBuilder<int>.Create();// ISSUE: reference to a compiler-generated fieldstateMachine.<>4__this=this;// ISSUE: reference to a compiler-generated fieldstateMachine.<>1__state=-1;// ISSUE: reference to a compiler-generated fieldstateMachine.<>t__builder.Start<MyClass1.<Method2>d__1>(refstateMachine);// ISSUE: reference to a compiler-generated fieldreturnstateMachine.<>t__builder.Task;}privatestaticobjectMethod2″([In]objectobj0,[In]object[]obj1){return(object)((MyClass1)obj0).Method2′();}}
The text was updated successfully, but these errors were encountered:
reproduction repo: https://github.com/moonheart/MrAdvice_issue
Details
There are two advices in ClassLibrary1:
GenericAdvice<TReturn>
andNonGenericAdvice
, when building finished, theNonGenericAdvice
works as intended, butGenericAdvice<TReturn>
only works in the same project as the advice .Class in same project works:
Class in different project not work:
The text was updated successfully, but these errors were encountered: