Why does compiler emit async state machine for async methods with only synchronous code? #4088
-
I can mark a method as async and do not use await, I get a warning from the compiler: public async Task Foo()
{
} When I look at IL (at least in LinqPad) I see that compiler emits code for state machine. Why not just wrapping the result with the task? In this case it would be |
Beta Was this translation helpful? Give feedback.
Answered by
YairHalberstadt
Oct 30, 2020
Replies: 1 comment
-
This has been discussed on roslyn at dotnet/roslyn#3659 In short, they would take this, but you would have to be careful to keep semantics exactly the same. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
YairHalberstadt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This has been discussed on roslyn at dotnet/roslyn#3659
In short, they would take this, but you would have to be careful to keep semantics exactly the same.