Find missing await in solution

谁说胖子不能爱 提交于 2019-12-05 12:52:04

This should be shown as compiler warning CS4014 with the text:

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.

See the documentation

So all you should need to do is compile the code. VS should allow you to navigate to the relevant locations from its Error List.

The easiest way to find them all is just compile the code.

Any function that has async but no await inside of it will cause compiler warning CS4014, once you compile your project look through the list of warnings and you will see all of the functions you need to fix.

If the method doesn't contains even one await you may check the output window. After compilation you'll find This async method lacks 'await' operators and will run synchronously ... warning. Double click on that warning will take you to the relevant method.

True you'll get the warning BUT if your app works without waiting those functions maybe you don't want to await them, just assign the resulting task to a variable to turn off the warning the guys told you about.

Obviously this is up to you to decide.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!