Sonarlint in Visual Studio shows error when rules not in private sonarqube

I am using Sonarlint in Visual Studio 2022 and connect my sonarlint to my private sonarqube.
I deploy sonarqube with version 10.3, which don’t contain Csharp rule S6966(C# static code analysis).

But when I use visual studio 2022 with sonarlint and connect to my private sonarqube, it shows the violation of rule that my private sonarqube does not contain(S6966).


I am sure that I have connected to my private sonarqube because I can disable S2551 in my sonarqube UI and the error will disappear.
When I use Jetbrains Rider with sonarlint the above bug won’t happen, only happen in visual studio.

How can I disable the rule that my private sonarqube does not contain??
The sonarlint should only detect the rule that private sonarqube contains.

Hi @Teng_JH and welcome to the Community!

The behavior you’re observing is not a bug, but rather a difference in the implementation.

SL for Rider fetches the C# analyzer plugin from the server you’re connected to, and therefore, that plugin version can’t produce an issue for the rule S6966, which was added fairly recently.

In SL for VisualStudio, we always use the C# analyzer that comes bundled within the extension and we do not change that regardless of the server. We also currently only disable rules that were explicitly disabled on the server, but since the server doesn’t know about this rule yet (due to the rule being added after SQ10.3), we keep the rule enabled.

I will consult with our Product Manager to see if we want to change this behavior to a different default / introduce a setting to change it.