Here ReSharper has a special code. He will not warn about this ReferenceEquals:
if (ReferenceEquals(obj, null)) { throw new ArgumentNullException("obj"); }
He will warn about this ReferenceEquals:
if (ReferenceEquals(obj, null)) { return 0; }
Throwing an ArgumentNullException is consistent with the contract specified in IEqualityComparer (Of T). GetHashCode
If you go to the definition of IEqualityComparer (F12), you will also find additional documentation:
// Exceptions: // System.ArgumentNullException: // The type of obj is a reference type and obj is null. int GetHashCode(T obj);
So, ReSharper is right that something is wrong, but the error displayed does not correspond to the change you have to make to the code.
Denise skidmore
source share