False positive "Expression is always false" using Assertions

Hello

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.

2 comments

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

-1

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

1

Please sign in to leave a comment.