Please provide
- Operating system: Windows 10 Enterprise 21H2
- Visual Studio version: 2019 v16.11.31
- SonarLint plugin version: 7.4.0.80741
- Programming language you’re coding in: C#
- Is connected mode used: NO
And a thorough description of the problem / question:
This kind of code implicitly checks if left and right are null together so in the 3rd condition none could be null:
if (left == right)
return true;
else if (left == null && right != null || left != null && right == null)
return false;
else if (left.Length != right.Length)
return false;
else
return true;
This problem was reported in 2019 but it still exists. See:
C#: False positive variable is null on at least one execution path - SonarCloud - Sonar Community (sonarsource.com)