Back to Devexpress

CRR0027 - Possible System.NullReferenceException

coderushforroslyn-400992-static-code-analysis-analyzers-library-crr0027-possible-system-null-reference-exception.md

latest1.5 KB
Original Source

CRR0027 - Possible System.NullReferenceException

  • Feb 28, 2025

This analyzer detects unprotected code that can potentially raise a System.NullReferenceException exception.

CodeRush checks the following elements: member’s qualifiers, collections inside of a foreach loop, collections used to call indexers.

How to Enable

Choose the Possible System.NullReferenceException issue in the Editor | Language | Code Analysis | Code Issues Catalog options page and check the Enabled checkbox.

Null Reference Analysis Modes

CodeRush can analyze values in Trusting , Skeptical , and Thorough diagnostic modes. You can specify the Possible System.NullReferenceException diagnostic mode for methods, properties, parameters, fields, and local variables. See Null Reference Analysis topic for more information about each diagnostic mode.

Customization

You can configure the Possible System.NullReferenceException diagnostic’ settings in the Editor | Language | Code Analysis | Possible NullReferenceException options page. The following screenshot shows the default settings.

CodeRush also provides an option to check anonymous methods’ parameters.

See Also

Suppress Analyzers