Make sure to read this post before raising a thread here:
Then tell us:
- What language is this for? CSharp
- Which rule? S2583
- Why do you believe it’s a false-positive/false-negative? Analyzer is missing that there is a lambda which could assign a value to
e
below. - Are you using
- SonarCloud? No
- SonarQube - which version? No
- SonarLint - which IDE/version? Nuget: SonarAnalyzer.CSharp Version="9.17.0.82934
- in connected mode with SonarQube or SonarCloud? No
- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
Error? e = null;
deleteInfo.Switch(
info => doStuff(info),
err => e = err);
if (e is not null) // False positive here.
{
return e;
}