False positive "Expression is always false" using Assertions


i have this code:

var queryByModel = this.GetQueryResult(...)

Debug.Assert(queryByModel != null);

if (queryByModel == null)


    return new List<TopOffer>();


Resharper complains that queryByModel == null expression is always false. This is true for Debug builds, but it should not suggest to do anything about it.

Comment actions Permalink

In debug mode, ReSharper will tell you about heuristically unreachable code.
In release mode, resharper will say nothing.

To modify the code or not - is up to the developer

Comment actions Permalink

Warnings generated against the debug.assert obsfucate real heuristically unreachable warnings.


Please sign in to leave a comment.