TypeName | DisposableVariableNotDisposedAnalyzer |
Check Id | CC0022 |
Category | Usage |
Severity | Warning |
A method has a disposable object (an object created from a class that
implements IDisposable
) and is not disposing the object through
a Dispose
call or a using
block.
The variable cannot be saved to a field or returned.
A code fix will be presented to you that will transform the code, it will wrap
the object creation expression in a using
block if the scope allows it, like so:
If the scope does not allow for a using
block it will simply add a Dispose
call
to the end of the method.
SuppressFinalize
TBD