-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
await Async method will create wrong IL #83
Comments
I think your OnExit method should look like the following: /// <inheritdoc />
public override void OnExit(MethodExecutionArgs arg)
{
if (arg.ReturnValue is Task t)
{
t.ContinueWith(_ =>
{
Console.WriteLine($"OnExit {Thread.CurrentThread.ManagedThreadId}");
}, TaskContinuationOptions.ExecuteSynchronously);
}
else
{
Console.WriteLine($"OnExit {Thread.CurrentThread.ManagedThreadId}");
}
} |
It's been too long. |
I think the issue here is that there's a difference currently whether an aspect is applied to a class or to a method directly. If it is applied directly to an async method there is special handling of the underlying
|
@mjvh80 so the solution would be to identify the compiler generated state machine class and skip weaving anything in it? |
TestClass:
method boundary Aspect:
caller:
The result:
The text was updated successfully, but these errors were encountered: