False positive of csharpsquid:S1116

Please provide

  • Operating system: MacOS
  • SonarLint plugin version:
  • Programming language you’re coding in: C#
  • Is connected mode used: No

And a thorough description of the problem / question:
new List<int>().Should().BeEquivalentTo([5]);

False positive rule activation: csharpsquid:S1116 (Empty statements should be removed)
Expected result:
no rule activation because there is no redundant semicolon and code is valid

Hi @dmitriy.vorobey1! Welcome to Sonar community.
Your issue seems very similar to this one.

Are you using the latest version of the .Net 8 SDK from November 14?

Hi Cristian,
Yeap, they are really similar. But I didn’t catch a solution.

My SDK version :
dotnet --version
Also I double checked sonar lint plugin version:

Hi, I’ve been seeing this false positive as well and thought I’d hop in to provide some additional data points.

I tried building a minimal repro (See GitHub) for it using SonarAnalyzer.CSharp (which is currently the latest version) and noticed that, using Rider with the SonarLint Plugin, I would only get the false positive from the plugin, not from the analyzer:



Notice how both the plugin and the analyzer (on build) report S125 because of the commented out line of code, but the analyzer does not report S1116, only the plugin.

So it seems to be a plugin-specific thing i guess? Hope these observations help in finding the cause :slight_smile:

Here’s the info from Rider’s about dialog:

JetBrains Rider 2023.3.1
Build #RD-233.11799.303, built on December 12, 2023
<... Lisencing / Subcription info ...>
Runtime version: 17.0.9+7-b1087.7 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
.NET Core v7.0.10 x64 (Server GC)
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 4
Non-Bundled Plugins:
  <... Other plugins ...>
  org.sonarlint.idea (

and the relevant output from dotnet --info:

$ dotnet --info
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.6c33ef20

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.100\

.NET workloads installed:
 Workload version: 8.0.100-manifests.6c33ef20
There are no installed workloads to display.

  Version:      8.0.0
  Architecture: x64
  Commit:       5535e31a71

.NET SDKs installed:
  6.0.100-rc.1.21458.32 [C:\Program Files\dotnet\sdk]
  7.0.114 [C:\Program Files\dotnet\sdk]
  8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.0-rc.1.21451.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Hi guys!
Issue seems to be fixed in SonarLint plugin version
Thanks a lot!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.