Fix S2589 FP: Var pattern should not raise #8326
Labels
Area: C#
C# rules related issues.
Area: CFG/SE
CFG and SE related issues.
Type: CFG/SE FPs
Rule IS triggered when it shouldn't be for CFG and SE rules.
Milestone
The
var
pattern always matches, which is why it is raising S2589. While this is technically correct (the best kind of correct), it does not make sense to raise here, since the point of the pattern is to be a catch-all.When implementing an exception, make sure that the rule about unreachable code (S2583) still raises, if necessary:
The text was updated successfully, but these errors were encountered: