False positive for CA2000 when disposable field is captured by an instance field #6760
Labels
Area-Microsoft.CodeAnalysis.NetAnalyzers
Bug
The product is not behaving according to its current intended design
False_Positive
A diagnostic is reported for non-problematic case
Resolution-By Design
Milestone
Analyzer
Diagnostic ID: CA2000:
Dispose objects before losing scope
Analyzer source
NuGet Package: Microsoft.CodeAnalysis.NetAnalyzers
Version: 7.0.3
Describe the bug
CA2000 is emitted on an expression which is later captured by an instance field and then disposed.
Steps To Reproduce
Expected behavior
No diagnostic is emitted.
Actual behavior
warning CA2000: Call System.IDisposable.Dispose on object created by 'new HttpClientHandler()' before all references to it are out of scope
Additional context
The text was updated successfully, but these errors were encountered: