-
Notifications
You must be signed in to change notification settings - Fork 241
Closed
Labels
False NegativeRule is NOT triggered when it should be.Rule is NOT triggered when it should be.
Milestone
Description
Description
S2589 doesn't work with binary tuple operations, resulting in FNs.
Repro steps
public class Repro_8486
{
public void Method()
{
string text1 = SomeString();
string text2 = SomeString();
if ((text1, text2) == (null, null) && text1 != null) // FN
{
Console.WriteLine();
}
if ((text1, text2) != (null, null) && text1 == null) // FN
{
Console.WriteLine();
}
if ((text1, text2) != (SomeString(), null) && text1 == null) // Compliant
{
Console.WriteLine();
}
string text3 = null;
string text4 = "";
string text5 = SomeString();
if ((text3, text4) == (null, null)) // FN
{
Console.WriteLine();
}
if ((text3, text4) != (null, null)) // FN
{
Console.WriteLine();
}
if ((text3, text5) == (null, null)) // Compliant
{
Console.WriteLine();
}
}
private string SomeString() => "";
}Expected behavior
S2589 should be raised.
Actual behavior
No issue is raised.
Implementation details
The rule itself doesn't need fixing. A Processor must be created for BinaryTupleOperation.
Related information
- C#/VB.NET Plugins version: 9.15
- Visual Studio version: 17.8.3
- Operating System: Windows 10
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
False NegativeRule is NOT triggered when it should be.Rule is NOT triggered when it should be.