S1940: FP with null-conditional operator #2427
Labels
Area: C#
C# rules related issues.
Area: VB.NET
VB.NET rules related issues.
Type: False Positive
Rule IS triggered when it shouldn't be.
Milestone
Repro steps
Expected behavior
Rule S1940 should not triggered
Actual behavior
On example above sonar suggest replace
!(collection?.Count > 0)
withcollection?.Count <= 0
, but ifcollection == null
conditions are not equal.In same time, in this code:
Sonar doesn't suggest replacement (and that's right behavior).
Related information
The text was updated successfully, but these errors were encountered: