S3900 FP on C# - Arguments of public methods should be validated against null

SonarQube 8.0
SonarC# 8.0
SonarScanner for MSBuild 4.7.1
MSBuild 15.9

I was trying to get ride of a code smell added a few versions ago (Null checks should not be used with “is”), but when I fix that one, the one I’m raising in this false positive appears.

The issue come because i’m not checking obj against null, but doing obj is ProjectModel should be enough.

public override bool Equals(object obj)
    var equals = (obj is ProjectModel) && (obj.GetHashCode() == GetHashCode());
    if (equals)
    return equals;

thanks @Jose for the detailed reproducer

I’ve opened https://github.com/SonarSource/sonar-dotnet/issues/2775