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

Improve CS0201 (ERR_IllegalStatement) codefix to suggest adding discard so that Action overload is picked #77324

Open
Youssef1313 opened this issue Feb 24, 2025 · 1 comment
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@Youssef1313
Copy link
Member

The _ = discard is not super obvious from the current lightbulb fixes for cs0201, it suggests changing the return type of the test method.

Is it possible to specifically add code fix for that case?

Image

Originally posted by @nohwnd in #5112

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 24, 2025
@Youssef1313
Copy link
Member Author

The idea here is that if this error is in a lambda where the method has an Action overload, but not a Func<Something> overload, simply adding _ = would fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

1 participant