Hello,
we looked in to the issue and can confirm that this is a False Positive. The minimal code that raises the issue is
public void UsedInFinally_AfterOtherAssignment()
{
int value = 42;
try
{
SomethingThatCanThrow();
}
catch (Exception ex)
{
value = 0; // Noncompliant False Positive
throw;
}
finally
{
object o;
o = ""; // Any assignment (also var s = ""; or var o = new object();) hides the usage of value in the next line
Use(value);
}
}
We added this False Positive to our backlog.
Best, Martin