C# sonar analyzer reports S2583 even if it is no the case.
public static string Test(object value) {
if (value is bool boolValue && !boolValue) {
return "Valid";
}
return "Not Valid";
}
The condition can be true, depending on input. It should not be a bug.
The condition is marked as a bug.
Please provide a description of any known workarounds.
C#/VB.NET Plugins Version
Visual Studio Version
Visual Studio Community 19
Hi @marco6,
Rule S2255 is a security hotspot related to cookies: "Writing cookies is security-sensitive" but the code from the repro steps doesn't seem related to cookies nor does it raises issues for this rule. Could it be that you used a wrong id?
Thank you
Sure I have! That was the code line... I will edit asap: the real code was S2583...

Hi @marco6
Thanks for the quick reply. I can confirm the problem and the fact that we generate a false positive in this case.
Since we have already a very similar issue: https://github.com/SonarSource/sonar-dotnet/issues/3110 I will close this one as a duplicate.
Yeah, I missed that because I had the issue id wrong. Thank you for your time!
Thank you for taking time to report this. Feedback is appreciated and considered since we try to prioritize first the issues with biggest impact (e.g. the ones which affect more users).