S1905 - False Positives generated by OfType<> in nullability scenarios

The ananalyzer reports S1905 if an collection of nullable objects is filtered into a collection of non-nullable objects, although that has two effects:

  • removes all null elements,

  • changes the resulting type.

     public static void TestOfType()
          var test = new string?[] { "one", "two", null, "three" };
          Console.WriteLine(string.Join(", ", test));
          Console.WriteLine(string.Join(", ", test.OfType<string>()));

The code above raises a S1905 on the OfType() call, although the call is clearly making a different. The resulting output is:

one, two, , three
one, two, three

The analyzer version is

thank you @Miroslav_Jeras, I confirm the FP and opened https://github.com/SonarSource/sonar-dotnet/issues/3273 to track it