Suspicious Predeclared Instance Access
This inspection warns about references to the default instance of a class, inside that class.
Reasoning
While a stateful default instance might be intentional, when it isn't it's easily a source of bugs. Use the Me qualifier to explicitly refer to the current instance and eliminate any ambiguity. Global state accidentally stored in a class' default instance is not shared by all other instances of that class.
Default severity
Warning
Inspection type
CodeQualityIssues
Examples
This example should trigger a result
This example should NOT trigger a result
Rubberduck.CodeAnalysis.Inspections.Concrete.SuspiciousPredeclaredInstanceAccessInspection.cs (Prerelease-v2.5.9.6289)