Fix S1125 FP: Type check with System.Object #7792
Labels
Area: C#
C# rules related issues.
Area: VB.NET
VB.NET rules related issues.
Sprint: Hardening
Fix FPs/FNs/improvements
Type: False Positive
Rule IS triggered when it shouldn't be.
Milestone
Description
I'm not sure if this is by intent but I think there is an issue with recognizing S1125
Boolean literals should not be redundant
when source type is not bool.Repro steps
Data
is of type IDictionary - which has kay/value as object. Therefore I thinkis true
pattern matching is valid at this point. If I am wrong please correct me :)Removing the pattern matching results in code that can not be compiled
Expected behavior
My expectation would be, that that pattern matching is valid.
Actual behavior
Actual behavior is a warning - which leads to build error when having warnings as errors enabled.
Known workarounds
Using
as
operator for converting doesn't give a warning:Related information
The text was updated successfully, but these errors were encountered: