False positive ConditionIsAlwaysTrueOrFalse with Nullable C# feature
Completed
if I have the following function:
void Foo(Bar b)
{
if (b == null) throw new ArgumentNullException();
}
In this case the (b == null) is flagged as always false, which is just not true. Adding a ! after the null fixes it (ie (b == null!))
Please sign in to leave a comment.
Hello Andy Rotering
Thank you for contacting us! Which ReSharper version do you run? I can't reproduce the issue with the ReSharper 2022.1 EAP7
Please give it a try and let me know, it's probably fixed in the upcoming 2022.1 version.
I am using 2021.3.3. I will try with EAP7
I am still seeing this after installing EAP7. Adding
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
hides the onscreen red squiggly.
Andrey Simukov did you see my comment that I was still able to reproduce this with EAP7?
Andy Rotering I'm sorry for the delay. Could you share a sample solution? You can send it privately via a support ticket created by the Submit a Request dialog above.