Open kevinoid opened 6 months ago
Hi @kevinoid! I confirm this as a FP. At this stage, our Symbolic Execution engine is not tracking events nor delegates, resulting in this kind of false positives. We don't have a specific timeline for this issue to be fixed but I'll add it to our backlog. Thanks!
@cristian-ambrosini-sonarsource I have disabled this rule in our configuration because I think the risk is too high that someone removes a condition that the rule says is redundant but is actually required. It would be better if the rule does not report anything if the affected code is too hard to analyze properly.
It's sad because this kind of rule would be very useful if it did not cause false positives (some false negatives are acceptable).
By the way, I consider the reproducer to have a threading bug (unsynchronized access to elapsed
).
Description
S2589 warns that a variable which is only assigned in a local function always evaluates to the same value.
Repro steps
Expected behavior
S2589 is not produced.
Actual behavior
Known workarounds
The warning can be suppressed.
Related information