Skip to content

Commit

Permalink
S2583: Add FP Repro for #8719 (#8720)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Pohlmann committed Feb 14, 2024
1 parent 5fc092e commit e5345df
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3956,3 +3956,32 @@ public void Method(bool condition1, bool condition2)
}
}
}

// https://github.com/SonarSource/sonar-dotnet/issues/8719
class Repro_8719
{
void Method()
{
var success = false;
Exception exception = null;
int retries = 0;
while (!success && retries < 5) // Noncompliant
{
exception = null;
try
{
Console.WriteLine();
success = true;
}
catch (Exception e)
{
exception = e;
}
}
if (exception != null) // FN!
{
Console.WriteLine(exception);
}
Console.WriteLine(success);
}
}

0 comments on commit e5345df

Please sign in to comment.