Topic | Value |
---|---|
Id | IDISP007 |
Severity | Warning |
Enabled | True |
Category | IDisposableAnalyzers.Correctness |
Code | DisposeCallAnalyzer |
LocalDeclarationAnalyzer | |
UsingStatementAnalyzer |
Don't dispose disposables you do not own.
Disposing IDisposables
that you have not created and do not own can be a bug.
Don't dispose them.
Configure the severity per project, for more info see MSDN.
#pragma warning disable IDISP007 // Don't dispose injected
Code violating the rule here
#pragma warning restore IDISP007 // Don't dispose injected
Or put this at the top of the file to disable all instances.
#pragma warning disable IDISP007 // Don't dispose injected
[System.Diagnostics.CodeAnalysis.SuppressMessage("IDisposableAnalyzers.Correctness",
"IDISP007:Don't dispose injected",
Justification = "Reason...")]