All rules
CA1821Performance Enabled by default: As suggestion

Remove empty finalizers

Remove empty finalizers

Microsoft docs

Description

Whenever you can, avoid finalizers because of the additional performance overhead that's involved in tracking object lifetime. The garbage collector runs the finalizer before it collects the object. This means that at least two collections are required to collect the object. An empty finalizer incurs this added overhead without any benefit.

Cause

A type implements a finalizer that is empty, calls only the base type finalizer, or calls only conditionally emitted methods.

How to fix violations

Remove the empty finalizer. If a finalizer is required for debugging, enclose the whole finalizer in #if DEBUG / #endif directives.

When to suppress

Do not suppress a message from this rule.

Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0