Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.28 KB

IDISP018.md

File metadata and controls

50 lines (36 loc) · 1.28 KB

IDISP018

Call SuppressFinalize

Topic Value
Id IDISP018
Severity Warning
Enabled True
Category IDisposableAnalyzers.Correctness
Code DisposeMethodAnalyzer

Description

Call SuppressFinalize(this) as the type has a finalizer.

Motivation

Call GC.SuppressFinalize(this) if the type has a finalizer.

How to fix violations

Use the code fix.

Configure severity

Via ruleset file.

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

Via #pragma directive.

#pragma warning disable IDISP018 // Call SuppressFinalize
Code violating the rule here
#pragma warning restore IDISP018 // Call SuppressFinalize

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

#pragma warning disable IDISP018 // Call SuppressFinalize

Via attribute [SuppressMessage].

[System.Diagnostics.CodeAnalysis.SuppressMessage("IDisposableAnalyzers.Correctness", 
    "IDISP018:Call SuppressFinalize", 
    Justification = "Reason...")]