4 Replies Last post: Mar 30, 2012 9:36 PM by Charles Hooks  
Charles Hooks Newbie 12 posts since
Sep 16, 2011
Currently Being Moderated

Mar 23, 2012 1:05 AM

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.

 

http://msdn.microsoft.com/en-us/library/bb291976.aspx

 

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

Andrey Serebryansky JetBrains 2,900 posts since
Jan 12, 2005
Currently Being Moderated
Mar 25, 2012 7:38 PM in response to: Charles Hooks
Re: Is there anyway to turn off "Check if 'variable' is null" in R# 6.1.0?

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

http://www.jetbrains.com

"Develop with pleasure!"

Richard Deeming Novice 142 posts since
Oct 6, 2010
Currently Being Moderated
Mar 30, 2012 4:06 PM in response to: Charles Hooks
Re: Is there anyway to turn off "Check if 'variable' is null" in R# 6.1.0?

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

More Like This

  • Retrieving data ...