SonarQube for IntelliJ plugin version: 11.15.0.84329
IntelliJ version: Rider 2025.3.3
Programming language you’re coding in: C#
Is connected mode used: No
SonarQube Cloud, SonarQube Server, or SonarQube Community Build? (if one of the latter two, which version?):
And a thorough description of the problem / question:
This Code
[PublicAPI]
public static class MyExtensionsClass
{
extension(object instance)
{
public void Bla()
{
//this is part of a public api not called by the project
}
}
Generates the following error:
csharpsquid:S1144
Remove unused constructor of private type 'MyExtensionsClass'.
These methods are not called directly in the project, but are unit tested. They are marked public via the JetBrains.Annotation.PublicAPIAttribute.
This only seems to happen in the IDE plugin. If I use the Sonar.Analyzers it does not surface a warning.
I tried adding [PublicAPI] above the extenson block, this did remove the warning in the IDE but results in a compilation error.
I’m also getting a similar false positive for extension properties. Again only flagged by the IDE plugin and not by the latest version of the analyzers. Thanks.
Thanks for the detailed report and the follow-up on extension properties.
Why this happens
The SonarQube for IntelliJ plugin 11.15 uses OmniSharp as its C# analysis host. The version of OmniSharp bundled in 11.15 uses a Roslyn release from the .NET 8 era, which predates C#14 and has no knowledge of extension block syntax. When it encounters extension(T receiver) { ... }, it falls back to error-recovery parsing and produces constructor-like syntax nodes. S1144 then sees what looks like an implicit private constructor and reports it as unused. The CLI analyzers use the same dotnet SDK that is used to build the solution and therefore don’t have this problem.
I have forwarded the issue to the IDE team. They are currently re-architecting the OmniSharp bundling, which should address this in the future.
In the meantime, a safe workaround is to suppress the issue with our suppression mechanism. Thanks for reporting!