-
Notifications
You must be signed in to change notification settings - Fork 473
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
CA2000 emitted when await using (false positive) #3042
Comments
Seeing the same behaviour after updating to VS 2019 16.4. No way to fix, other than suppress the issue. |
Same here. For teams like ours who use code analysis and warnings as errors (we consider both "best practice"), this means that our existing solution is no longer building after upgrading Visual Studio. Not really a great way of introducing a new .net release 🐞 Edit: Some quick tests show that the error only seems to happen when using a class that inherits from a class that implements |
Similarly to @Kharos, we're also setting all warnings to Errors when compiling in Release mode. It is a bit naff having to wrap the "offending" lines with pragma warning disable comments.
|
#3098 should fix this. |
Fixed with #3098. I will post the beta package that you can try out to verify in a bit. |
When will the fix be available in release build? This issue is really annoying. |
@DenSmoke, I have Just upgraded my project to "Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" and I don't have the issue anymore. |
I still have it on 3.3.0 with the following code
|
I'm getting the false positives on I'm using |
Please re-open this bug. I'm using VS 17.0.6 and experiencing the same problem with this code:
"new FileStream" triggers CA2000. |
Yeah, the issue still exists. Please re-open this bug! It's super annoying that such a common feature is not handled correctly by the analyzers. |
Analyzer package
Microsoft.CodeAnalysis.FxCopAnalyzers
Package Version
v2.9.7 (Latest)
Diagnostic ID
Example: CA2000
Repro steps
Expected behavior
The context is created with a using statement, and will be disposed of when it goes out of scope and so no CA2000 error should not be emitted.
Actual behavior
A CA2000 error is emitted.
However, were we to drop the
await
commandusing var context = new DocTypesContext(this.options);
then the error is not emitted, but we really do need to put theawait
in.The text was updated successfully, but these errors were encountered: