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

Ensure assignment to a discard produces VSTHRD110 #345

Closed
sharwell opened this issue Aug 8, 2018 · 1 comment
Closed

Ensure assignment to a discard produces VSTHRD110 #345

sharwell opened this issue Aug 8, 2018 · 1 comment

Comments

@sharwell
Copy link
Member

sharwell commented Aug 8, 2018

Is your feature request related to a problem? Please describe.

The following code should produce a warning. Currently Roslyn is using discards in a few places to address CS4014 prior to updating the code to enforce VSTHRD110 (a more strict analyzer with the same intent). We should ensure that VSTHRD110 is reported for this scenario.

async Task Method()
{
  _ = Task.Run(() => 3); // VSTHRD110: Observe result of async calls
}
@AArnott
Copy link
Member

AArnott commented Aug 12, 2018

As that is a common way for folks to suppress the warning when they really don't want it tracked, I'm not sure why we want to defeat it. We offer a .Forget() extension method for this purpose as well.

@AArnott AArnott added the wontfix label Dec 3, 2018
@AArnott AArnott closed this as completed Dec 3, 2018
AArnott pushed a commit that referenced this issue Feb 5, 2025
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@microsoft microsoft deleted a comment from jjramon1699-ai Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants