MethodBoundaryAspect.Fody
MethodBoundaryAspect.Fody copied to clipboard
How to make the asynchronous OnEntry method execute after the execution of the decorated method?
I found that if the OnEntry method is asynchronous, it will run alternately with the decorated method, which is not the result I want, and I want OnEntry to be executed in its entirety first.
public class AutoGetAccessToken : OnMethodBoundaryAspect
{
public override async void OnEntry(MethodExecutionArgs arg)
{
await RequestOrRefreshAccessTokenAsync();
}
}
[AutoGetAccessToken]
public async Task<Repo> GetFileAsync()
{
// ...
}
Unfortunately we don't support this. Your method "GetFileAsync" runs concurrent because there is no Task returned from "OnEntry" so nobody is awaiting the call.