IDISP009

November 25, 2021 ยท View on GitHub

Add IDisposable interface

TopicValue
IdIDISP009
SeverityWarning
EnabledTrue
CategoryIDisposableAnalyzers.Correctness
CodeDisposeMethodAnalyzer

Description

The type has a Dispose method but does not implement IDisposable.

Motivation

ADD MOTIVATION HERE

How to fix violations

ADD HOW TO FIX VIOLATIONS HERE

Configure severity

Via ruleset file.

Configure the severity per project, for more info see MSDN.

Via #pragma directive.

#pragma warning disable IDISP009 // Add IDisposable interface
Code violating the rule here
#pragma warning restore IDISP009 // Add IDisposable interface

Or put this at the top of the file to disable all instances.

#pragma warning disable IDISP009 // Add IDisposable interface

Via attribute [SuppressMessage].

[System.Diagnostics.CodeAnalysis.SuppressMessage("IDisposableAnalyzers.Correctness", 
    "IDISP009:Add IDisposable interface", 
    Justification = "Reason...")]