Description
Version Used: VS 16.7.1
Steps to Reproduce:
Attempt to use the await operator (e.g. await Task.Delay(0)) in the watch window while debugging a method.
Expected Behavior:
An error message explaining that the debugger doesn't support await, possibly suggesting to use .Result/.Wait() instead. Or even better, await works in the debugger.
Actual Behavior:
In the case of an async method, the error shown in the watch window is:
error CS4032: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task<Task>'.
For a non-async method, the error is almost the same:
error CS4033: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
In both cases, the error is misleading: For the async method, it's already async and returns a Task, so the suggestion doesn't make sense. For the non-async method, adding async wouldn't fix the issue, so it's also wrong.