S2583 issue not reported by SonarLint in IDE, but found in PR scan by SonarCloud

Template for a good new topic, formatted with Markdown:

  • ALM used: Azure DevOps
  • CI system used: Azure Pipelines
  • Languages of the repository: C#

I’ve noticed that SonarLint does not find issue S2583 in VisualStudio in Connected Mode, however the issue is correcty found in the PR scan.

Here is a sample code:

public class Class1
    public string GetString()
        var value2 = string.Join(",", new string[] { "a", "b" });

        var value3 = value2 ?? string.Empty;

        return value3;

Locally I don’t see the error, however in the PR scan I get error in the line var value3 = value2 ?? string.Empty with the message: Change this expression which always evaluates to the same result. Some code paths are unreachable.

Is that the expected behaviour, and that error is not found by SonarLint only by SonarCloud?


Can you tell me which version of SonarLint you are using?
We have improved the rule recently, and it might be that the new version of our analyzer is used on SonarCloud, while it was not yet embedded in the version of SonarLint you were using.



Thanks for reply.

We are using version


SonarLint for Visual Studio version 7.2 contains the sonar-dotnet plugin version 9.7.
Rule S2583 was rewritten in version 9.8 which is already on SonarCloud.
This is causing the behavior you have.
SonarLint for Visual studio version 7.3 will contain the plugin version 9.8, so once you update the missing issue should be reported in your IDE as well.



Thank you