CRR0027 - Possible System.NullReferenceException
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.