semihokur / AsyncFixer

Advanced async/await Diagnostics and CodeFixes for C#
Apache License 2.0
165 stars 11 forks source link

Can this be added as a potential misuse of async? #10

Open dex3r opened 3 years ago

dex3r commented 3 years ago

Take a look at a SO question I have asked: https://stackoverflow.com/questions/65891357/is-there-a-way-to-warn-about-an-unawaited-tasks

Someone suggested this package, however it does not cover such case.

Is this something that can potentially be added to AsyncFixer?

semihokur commented 3 years ago

Yes, I can implement such an analyzer.

There is a built-in one to detect those cases under methods with async modifier. You will see the following warning if you add async to your Use method in the sample:

CS4014: Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.