You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
S2589 does not correctly evaluate constant and considers code to be unreachable.
Repro steps
privateconstintSOME_CONST=3;privatevoidTest(List<string>elements){inti=0;foreach(stringsinelements){i++;if(i>=SOME_CONST){// S2589 is thrown flagging the conditional as always falseConsole.WriteLine("Here");}}}
Expected behavior
S2589 should not be raised because the conditional is passable when elements.Count >= SOME_CONST
Description
S2589 does not correctly evaluate constant and considers code to be unreachable.
Repro steps
Expected behavior
S2589 should not be raised because the conditional is passable when
elements.Count >= SOME_CONST
Actual behavior
S2589 is thrown.
Known workarounds
None.
Related information
The text was updated successfully, but these errors were encountered: