Sonarqube thinks `ReferenceEquals(true,true);` is false

(Søren Reinke) #1
        if (ReferenceEquals(actual, expected)) //check if are the same or both null
            return true;
        if (actual == null || expected == null) //cheks if any of them is null
            return false;

        //At this point neither actual or expected can be null.
        if (actual.Count != expected.Count)

SonarQube complains about ‘actual’ or ‘expected’ could be null here in the last if, which is not possible.

According to MSDN:

 public static bool ReferenceEquals (object objA, object objB);

true if objA is the same instance as objB or if both are null ; otherwise, false .