Closed
Description
Analyzer package
Microsoft.CodeQuality.Analyzers
Analyzer
CA2000: Dispose Objects Before Losing Scope
Repro steps
- Follow https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2000-dispose-objects-before-losing-scope for example good code
2a) Allow IDE0017 to be applied - Object initialization can be simplified - on the temporary object
or
2b) Add a catch statement
or
2c) Encapsulate the return object (unsure if this is a false positive or a real positive
Expected behavior
CA2000 not to be reported
Actual behavior
CA2000 is reported
Sample code file attached.
CA2000.txt
Since i think it is 2 (potentially 3) false positives, but all on the same rule, i didn't know if you would want me to report them grouped together, or as a separate report for each. Sorry if i shouldn't have grouped them.
thanks
Mike
(And thanks for Roslyn and the Analyzers - they are great :))