CA2021 false positive on Enumerable.OfType<T>extension #7153
Labels
Area-Microsoft.CodeAnalysis.NetAnalyzers
False_Positive
A diagnostic is reported for non-problematic case
help wanted
The issue is up-for-grabs, and can be claimed by commenting
Milestone
Analyzer
Diagnostic ID: CA2021:
CA2021: Don't call Enumerable.Cast<T> or Enumerable.OfType<T> with incompatible types
Analyzer source
SDK: Built-in CA analyzers in .NET 8 SDK or later
Version: SDK 8.0.101
Describe the bug
Warning CA2021 is found on Enumerable.OfType call when T is compatible with underlining type in the enumerable collection.
Steps To Reproduce
Expected behavior
No CA2021 warning.
Actual behavior
CA2021 warning is found.
The text was updated successfully, but these errors were encountered: