Incorrect NullReference Exception Warning

 postVal in the Last line cannot be null but Resharper incoorectly warns about possible NullReference:

if ((preVal == null || preVal.Entities == null || preVal.Entities.Count < 1) && (postVal == null || postVal.Entities == null || postVal.Entities.Count < 1))
{
return false;
}

if (preVal == null || preVal.Entities == null || preVal.Entities.Count < 1 || postVal == null || postVal.Entities == null || postVal.Entities.Count < 1)
{
var entities = preVal == null || preVal.Entities == null || preVal.Entities.Count < 1 ? postVal.Entities : preVal.Entities;

0

Please sign in to leave a comment.