Fix S4158 FP: rule raised where there is no guarantees of emptiness #7582
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
Description
S4158 regarding iteration of known empty collections may be raised in situations where there is no guarantee that the collection is empty.
Repro steps
Expected behavior
S4158 is not raised, because there is no guarantee that
list
will be empty whenflag
is true.Actual behavior
S4158 is raised.
Known workarounds
Suppress the rule.
Related information
The text was updated successfully, but these errors were encountered: