Skip to content

Commit

Permalink
S2589/S2583: Add reproducer for #8094 (#8097)
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-georgiou-sonarsource committed Sep 27, 2023
1 parent 4bc3d07 commit ba33020
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,3 +495,18 @@ int SwitchExpression()
};
}
}

// https://github.com/SonarSource/sonar-dotnet/issues/8094
class Repro8094
{
public void TestMethod()
{
Action? someDelegate = delegate { };
someDelegate += Callback;
someDelegate -= Callback;
if (someDelegate == null) // Noncompliant {{Change this condition so that it does not always evaluate to 'False'.}}
{ }
}

private void Callback() { }
}

0 comments on commit ba33020

Please sign in to comment.