Skip to content
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

About UniversalWrapper #158

Closed
jerviscui opened this issue Jun 18, 2021 · 2 comments
Closed

About UniversalWrapper #158

jerviscui opened this issue Jun 18, 2021 · 2 comments

Comments

@jerviscui
Copy link
Contributor

The UniversalWrapper.cs, if used for a sync method and return Task:

public Task ATask()
{
    return Task;
}

Will thorw a convert exception in (Task<T>)target(args).
_asyncHandler need to add a check conditions methodInfo.GetCustomAttributes<AsyncStateMachineAttribute>().Any() conditions.

And UniversalWrapper use MethodBase.Invoke() method, I think Invoke() function doesn't have good performance.

How about add a async Around method for async method?

[Advice(Kind.Around, Targets = Target.Method)]
public void Handle()
{}

[Advice(Kind.Around, Targets = Target.Method)]
public async Task Handle()
{}

I don't know if I am right. Just a thought.

@pamidur
Copy link
Owner

pamidur commented Jul 6, 2021

Hi @jerviscui , we're currently working on more sophisticated version of Universal Wrapper here #148.

Apart of that I was long thinking about what you're suggesting - to make aspect compiler recognize and process async methods in different way. It would require some significant changes, so until then I guess upcoming version of #148 will do the trick

@pamidur
Copy link
Owner

pamidur commented Oct 18, 2021

I guess this should cover it #148
Feel free to reopen if needed

@pamidur pamidur closed this as completed Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants