ReSharper 8.0 Web Help

ReSharper performs Value Analysis for null references and boolean values. It heuristically detects accessing a variable that can possibly be null and immediately warns you about it:
It can also suggest that a condition is always true or false at a specific point in code.

You can refine this analysis and add additional sources for warnings with code annotation attributes. For instance, if you know that the Method in the example above should never return null, you can suppress related warnings with the NotNull attribute. Or else you can annotate a method with the CanBeNull attribute so that the analysis engine warns you about possible NullReferenceException where it cannot be detected heuristically:


To define how strict the value analysis should be, choose one of the options for the Assume entity value can be null setting in the ReSharper | Options | Code Inspection | Settings.


You can instantly repair such issues with quick-fixes.

See Also