Replies: 1 comment 1 reply
-
dotnet/roslyn is the repository for the compiler - you should create a discussion there as this isn't specific to ASP.NET Core. It wouldn't surprise me if there's already an existing issue related to this topic. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi .NET team,
I would like to propose an enhancement to the .NET compiler to introduce a warning when an async method does not return a Task (or Task), regardless of its current return type, including void.
Proposal:
Justification:
By introducing this warning, we can guide developers towards a more consistent and safer async programming model. This would help avoid potential mistakes such as:
The only justified use of async void should be in event handlers, where the method signature is predefined and doesn't allow returning Task. For all other cases, returning Task should be the default behavior.
Thank you for considering this suggestion! I believe this change could significantly improve async programming practices in .NET by encouraging developers to follow the intended patterns for asynchronous methods.
Best regards,
Christophe Feltz
Beta Was this translation helpful? Give feedback.
All reactions