Resharper don't consider null check of String.IsNullOrWhiteSpace

Resharper doesn't correct handle the String.IsNullOrWhiteSpace check for a string.

The code abode

string line = this._reader.ReadLine();

if (String.IsNullOrWhiteSpace(line))
{
    break;
}

var splitLine = line.Split(new[] { ':' }, 2);



Resharper tell me about a null reference exception when accessing the line variable in line 8. If I change the method to use String.IsNullOrEmpty, the possible null reference exception warning doesn't apear.

1 comment
Avatar
Andrey Serebryansky
Comment actions Permalink

Hello Sergio,

Thank you for reporting this problem! There's a bug-report in our bug-tracker:
http://youtrack.jetbrains.net/issue/RSRP-186427 and this problem will be
fixed in the next major ReSharper release.

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Resharper doesn't correct handle the String.IsNullOrWhiteSpace check
for a string.

The code abode
string line = this._reader.ReadLine();
if (String.IsNullOrWhiteSpace(line))
{
break;
}
var splitLine = line.Split(new[] { ':' }, 2);

Resharper tell me about a null reference exception when accessing the
line variable in line 8. If I change the method to use
String.IsNullOrEmpty, the possible null reference exception warning
doesn't apear.

---
Original message URL:
http://devnet.jetbrains.net/message/5275440#5275440



0

Please sign in to leave a comment.