Skip to content

Commit

Permalink
Add reproducer for #8378
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Pohlmann committed Nov 29, 2023
1 parent 2bfacf0 commit 2b7764d
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3391,3 +3391,25 @@ public void Method()
void DoSomeWork() { }
void LogError(Exception exception) { }
}


// Reproducer for https://github.com/SonarSource/sonar-dotnet/issues/8378
public class Repro_8378
{
public void Method()
{
var success = true;
try
{
var result = 100 / DateTime.Now.Second;
}
catch (Exception ex)
{
success = false;
}
if (success) // NoncompliantFP
{
Console.WriteLine("Success!");
}
}
}

0 comments on commit 2b7764d

Please sign in to comment.