I know this is self-evident to you. Unfortunately, it’s not to me.
What is / is not happening? Are you not seeing the SonarLint additions to the UI? They’re blank / empty? No issues are raised? Giant, work-stopping errors? Something else?
So I uninstalled Visual Studio, Python and Node.js.
I installed:
Python 3.13.0 (64-bit)
Node.js 23.1.0
Microsoft Visual Studio Enterprise 2022 (64-bit) v17.11.5
Added the ‘SonarLint for Visual Studio 2022’ Extension (8.6.0.10679) using the built-in Extension Manager.
And it does not work on my C# file…
Here is the SonarLint (verbose) output:
[ThreadId 5] [DEBUG] [SLCORE] Language of file "file:///C:/code/Consumers/SendToConsumer.cs" is detected to be "CS"
[ThreadId 5] [DEBUG] [SLCORE] Computing file exclusion for uri 'file:///C:/code/Consumers/SendToConsumer.cs'
[ThreadId 21] [DEBUG] [ExclusionSettingsStorage] Standalone mode, exclusions are not supported.
[ThreadId 21] [DEBUG] [AnalyzableFileIndicator] No server settings were found.
[ThreadId 21] [SLCoreAnalyzer] Analyzing C:\code\Consumers\SendToConsumer.cs with id
[ThreadId 21] [DEBUG] [SLCORE] Relativizing path: C:\code\Consumers\SendToConsumer.cs for git repo src\Consumers
[ThreadId 21] [DEBUG] [SLCORE] Triggering analysis with configuration: [
baseDir: C:\code\Consumers
extraProperties: {}
activeRules: [425 cpp, 24 css, 189 c, 267 typescript, 90 secrets, 265 javascript]
inputFiles: [
file:///C:/code/Consumers/SendToConsumer.cs (UTF-8)
]
]
[ThreadId 21] [DEBUG] [SLCORE] Start analysis
[ThreadId 21] [DEBUG] [SLCORE] Index files
[ThreadId 21] [DEBUG] [SLCORE] Language of file "file:///C:/code/Consumers/SendToConsumer.cs" is detected to be "CS"
[ThreadId 8] [DEBUG] [SLCORE] 1 file indexed
[ThreadId 34] [DEBUG] [SLCORE] Added 267 checks for language='ts', repository='typescript'
[ThreadId 34] [DEBUG] [SLCORE] Added 265 checks for language='js', repository='javascript'
[ThreadId 34] [DEBUG] [SLCORE] No registered JsAnalysisConsumer.
[ThreadId 34] [DEBUG] [SLCORE] 'JavaScript/TypeScript analysis' skipped because there are no related files in the current project
[ThreadId 34] [DEBUG] [SLCORE] 'JavaScript inside YAML analysis' skipped because there are no related files in the current project
[ThreadId 34] [DEBUG] [SLCORE] 'JavaScript inside HTML analysis' skipped because there are no related files in the current project
[ThreadId 34] [DEBUG] [SLCORE] Execute Sensor: CSS Rules
[ThreadId 34] [DEBUG] [SLCORE] No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
[ThreadId 34] [DEBUG] [SLCORE] Execute Sensor: TextAndSecretsSensor
[ThreadId 34] [DEBUG] [SLCORE] Available processors: 2
[ThreadId 34] [DEBUG] [SLCORE] Using 2 threads for analysis.
[ThreadId 34] [DEBUG] [SLCORE] The property "sonar.tests" is not set. To improve the analysis accuracy, we categorize a file as a test file if any of the following is true:
* The filename starts with "test"
* The filename contains "test." or "tests."
* Any directory in the file path is named: "doc", "docs", "test" or "tests"
* Any directory in the file path has a name ending in "test" or "tests"
[ThreadId 34] [DEBUG] [SLCORE] Analyzing all except non binary files
[ThreadId 34] [DEBUG] [SLCORE] 1 source file to be analyzed
[ThreadId 49] [DEBUG] [SLCORE] 1/1 source file has been analyzed
[ThreadId 49] [DEBUG] [SLCORE] Analysis detected 0 issues and 0 Security Hotspots in 374ms
[ThreadId 49] [SLCoreAnalyzer] Finished analyzing C:\code\Consumers\SendToConsumer.cs with id 820fb134-7a66-49f3-9435-1b57b45ccc39, analysis time: 0s
[ThreadId 49] [SLCoreAnalyzer] Found 0 issue(s) for C:\code\Consumers\SendToConsumer.cs
And I know for a fact that there are issues with this file, I can see them in my company’s sonarCloud account.
Sorry for the confusion. C# analysis is not displayed in the logs because it’s run via the native VisualStudio/Roslyn integration, and not directly by the extension. Could you check the VS Error List tool window and see if there are any filters enabled that could hide the issues from being displayed? Check if there are any AD0001 errors as well. If the problem persists, I kindly ask you to provide a minimal reproducer for it.
P.S. Python analysis is not supported by SL for VS. Node.js is also not required for C# analysis
So I guess this writeup from your webpage is incorrect.
It claims that:
It supports C#
Scans code written in C#…
But now you’re saying that your extension does not scan C# files, that is up to the native VisualStudio/Roslyn integration.
So why do I need your extension at all???
From your website:
SonarLint: Your first line of defense for quality and secure code
SonarLint helps you detect and fix Bugs, Code Smells, and Security Vulnerabilities in-IDE.
It supports C#, VB.NET, C, C++, JS, and TS. The extension highlights coding flaws on the fly and provides clear guidance to fix issues before code is committed.
What is SonarLint
SonarLint is a Free and Open Source IDE extension that identifies and helps you fix Code Quality and Code Security issues as you code. Analogous to a spell checker, SonarLint squiggles flaws and provides real-time feedback and clear remediation guidance so you can deliver clean code from the get-go.
SonarLint for Visual Studio is more than your average linting tool.
Scans code written in C#, VB.NET, C, C++, Javascript, TypeScript.
Open source JavaScript, TypeScript, C# & VB.NET code analyzers.
C and C++ support for Application, Dynamic Library and Static Library types of MSBuild (.vcxproj) projects
Deep code analysis algorithms using pattern matching and dataflow analysis
Hundreds of language-specific static code analysis rules, and growing
In-context help and remediation guidance with detailed examples
Highlights issues in your code, tells you why they are harmful, and how they should be fixed
SonarLint provides Visual Studio developers a comprehensive in-IDE solution for improving the quality and security of the code they deliver.
C# analysis is not displayed in the logs because it’s run via the native VisualStudio/Roslyn integration, and not directly by the extension.
This does not mean it’s not part of the extension, it only means that the analysis takes a slightly different integration route and does not produce any logs in SonarLint log tab. The analyzer is still shipped with the extension.
I’m asking you the following again, because you’re not providing any information that would allow me to help you:
Could you check the VS Error List tool window and see if there are any filters enabled that could hide the issues from being displayed? Check if there are any AD0001 errors as well. If the problem persists, I kindly ask you to provide a minimal reproducer for it.