Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading error for await in the watch window #46795

Open
svick opened this issue Aug 13, 2020 · 0 comments
Open

Misleading error for await in the watch window #46795

svick opened this issue Aug 13, 2020 · 0 comments
Labels
Area-Interactive Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@svick
Copy link
Contributor

svick commented Aug 13, 2020

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.

@jinujoseph jinujoseph added untriaged Issues and PRs which have not yet been triaged by a lead Area-Interactive Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 26, 2022
@jinujoseph jinujoseph added this to the Backlog milestone Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Interactive Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
None yet
Development

No branches or pull requests

2 participants