Is there anyway to turn off "Check if 'variable' is null" in R# 6.1.0?

Having way to many false positives and it is a warning with no inspection setting I can change. :(

The most common false positive is with .First methods...  


var survey = _infoturnHelper.Surveys.First(x => x.ImportId == template.ImportId);

Which according to MSN, will either return something or throw an exception.

So why is R# forcing me to null check it?

Hello Charles
     Have you tried turning off the 'Check if variable is null' action under ReSharper | Options | Languages | C# | Context Actions? Thank you!

Andrey Serebryansky

Senior Support Engineer

JetBrains, Inc

"Develop with pleasure!"


That worked, though it then gave the same warning, but for an inspection option for which I could then set to an hint.

Which R# would recognise when return values truly can be null, cause I have yet to find a case when it complains about a null that can actually have a null value.  I'm sure there has to be one valid case, but hitting 1 out of a thousand really is depressing odds. :(


Is it acutally flagging "survey" as possibly null, or is it one of the other objects (_infoturnHelper, _infoturnHelper.Surveys, x, or template)?


It is flagging survey.  The actual warning is on a different statement that is trying to use survey.


Please sign in to leave a comment.