Search code examples
resharperresharper-2018

Why does ReSharper report "expression is always false"? (for boolean Equals true true)


The unit test passing appears to contradict the inspection claim.

There are a lot of false reports of bugs with this inspection.

    public void Foo2()
    {
        bool objA = true;
        bool objB = true;

        var result1 = Equals(objA, objB);
        Assert.Equal(true, result1);
    }

inspection text contradicts unit test result

Using:

  • JetBrains ReSharper Ultimate 2018.2.1 Build 182.0.20180829.63240
  • Microsoft Visual Studio Enterprise 2017 Version 15.8.9

Solution

  • It's a ReSharper bug: https://youtrack.jetbrains.com/issue/RSRP-471261

    It was fixed in ReSharper 2018.2.2.