Hi, I found Sonarlint extension can’t found any C# questions. But other language like Python or Java is normal. Can you tell me what’s wrong or how to configure it?
I think I’m not the only one running into this problem.
Hi, I found Sonarlint extension can’t found any C# questions. But other language like Python or Java is normal. Can you tell me what’s wrong or how to configure it?
I think I’m not the only one running into this problem.
Hey there.
VSCode Version: 1.85.2
Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681
Date: 2024-01-18T06:40:11.430Z
Electron: 25.9.7
ElectronBuildId: 26354273
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 23.3.0
SonarLint `v4.5.0`
C# Dev Kit `v1.4.29`
C# `v2.23.15`
I think I don’t change any default settings for C# Analysis
Yes, the C# extension version is v2.23.15
Below is my test code
Classes should not be empty (csharpsquid:S2094)
public class Empty // TODO Noncompliant
{
}
It should some lint error but nothing happend.
Thanks. I have no issue getting an issue to raise here.
Is your .cs
file actually a part of a project/solution?
Thanks. This solved my problem.
I think C# files must be under a project to be scanned for problems by sonarlint, unlike Python, where a single file can be scanned.
Yes, this is very likely the root cause, thanks for sharing it!
The main reason behind this is that C# analysis relies on Roslyn (in this case, powered by OmniSharp) which requires a valid .Net project/solution to be loaded in the IDE (e.g. to resolve types).