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

Relax RCS1047 if the return value is a ValueTask #1495

Open
gumbarros opened this issue Jul 31, 2024 · 3 comments
Open

Relax RCS1047 if the return value is a ValueTask #1495

gumbarros opened this issue Jul 31, 2024 · 3 comments

Comments

@gumbarros
Copy link

Product and Version Used:
Latest
Steps to Reproduce:
image

Actual Behavior:

return await fluidTemplate.RenderAsync(context); //RCS1047

Expected Behavior:

return await fluidTemplate.RenderAsync(context); //No RCS1047
@josefpihrt
Copy link
Collaborator

Could you explain why do you think that method should not be treated as asynchronous when it return ValueTask<T>? ValueTask<T> is basically the same as Task<T> just with less allocations.

@gumbarros
Copy link
Author

Could you explain why do you think that method should not be treated as asynchronous when it return ValueTask<T>? ValueTask<T> is basically the same as Task<T> just with less allocations.

It's actually the opposite, the problem is that RCS1047 doesn't understand ValueTask as async and tells you to remove the async suffix.

@josefpihrt
Copy link
Collaborator

RCS1047 should be able to detect ValueTask:

https://github.com/dotnet/roslynator/blob/main/src/Core/SymbolUtility.cs#L641-L642

Could you post a code snippet that reproduces the bug? Which version are you on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants