SonarQube extension stopped showing issues in error list

Hi,

Can you verify that file:///C:/Users/cwdev/source/repos/myproj/myapp/myappweb/Controllers/HomeController.cs points to the correct file? Also, does pressing Ctrl + S multiple times and waiting help?

Also, the log cuts short a bit, I only see one attempt to run analysis. While the fact that it’s not running is already an issue (it thinks file doesn’t exist for some reason), forcing it with Ctrl + S should in theory make it think that the file exists, unless there is some other issue that is not logged. If in fact it fails to start analysis multiple times, I will try to provide a custom build with additional logging.

Regarding the change of analysis scope, I understand your frustration. Unfortunately, the built in analysis integration in VS is not very extensible, which prevents us from doing a lot of things with the extension, which is why, for example, until 9.0 we had different UX for Roslyn & non-Roslyn languages. We’re looking into bringing back the full scan functionality at some point, but due to limited resources it was not shipped in 9.0

Hi,

The file path is definitely correct.

Pressing ctrl+s runs it again and ends up in the same place, an infinite wait at [DEBUG] [ThreadId 117] [LinkedFileAnalyzer] Starting affected files calculation for ….

I agree the log looks cut short, but that’s where it stops.

Is the IDE responsive in the meantime or does it freeze?

The IDE remains fine.

Do you happen to have a ‘test’ project I can try scanning? That might simplify things.

Well, it should just work with any template from VS, like the default console app one. To see an issue, just add a // TODO comment in a C# file, you should see it highlighted and S1135 appear in the error list.

Ok so I have a .net framework 4.8 console application project with one file and this is the entire content:

This is the report output:

This is the log when I do a ctrl+s:
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Post: SonarLint Server RPC sequential executor 19
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Posting command from Scheduler: org.sonarsource.sonarlint.core.analysis.command.NotifyModuleEventCommand@544cce9d
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Posting command from Scheduler to queue: org.sonarsource.sonarlint.core.analysis.command.NotifyModuleEventCommand@544cce9d
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Posting command in analysis queue: org.sonarsource.sonarlint.core.analysis.command.NotifyModuleEventCommand@544cce9d, new size is 1
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Picked command from the queue: org.sonarsource.sonarlint.core.analysis.command.NotifyModuleEventCommand@544cce9d, 0 remaining
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Post: SonarLint Server RPC sequential executor 19
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Language of file “file:///C:/Users/cwdev/source/repos/myproj/myapp/mconsoleapp/Program.cs” is detected to be “CS”
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Posting command from Scheduler: org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand@15840dba
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Posting command from Scheduler to queue: org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand@15840dba
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Posting command in analysis queue: org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand@15840dba, new size is 1
[DEBUG] [ThreadId 141] [SLCore] [org.sonar.plugins.javascript.sonarlint.FSListenerImpl > sonarlint-analysis-scheduler] Processing file event C:/Users/cwdev/source/repos/myproj/myapp/mconsoleapp/Program.cs with event MODIFIED
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Picked command from the queue: org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand@15840dba, 0 remaining
[DEBUG] [ThreadId 141] [SLCore] [sonarlint > sonarlint-file-exclusions] Computing file exclusion for uri ‘file:///C:/Users/cwdev/source/repos/myproj/myapp/mconsoleapp/Program.cs’
[DEBUG] [ThreadId 127] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Starting analysis with configuration: [
baseDir: C:\Users\cwdev\source\repos\myproj
extraProperties: {sonar.cfamily.compile-commands=C:\Users\cwdev\AppData\Local\Temp\SLVS\VCXCD\5431ea93-a305-4aec-8d1d-9eda5a9f0e8c\58d7eecc-5766-4814-a415-d9947cae50e4.json, sonar.js.internal.bundlePath=C:\USERS\cwdev\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\17.0_3A8DD105\EXTENSIONS\NOMKUH3Z.K5V\EmbeddedEsLintBridge, sonar.sqvsRoslynPlugin.internal.serverPort=45873, sonar.sqvsRoslynPlugin.internal.serverToken=DLOuANS2pJr7PW76NvRZ4a7tue/ktLkZSTfEJhMBzWY=}
activeRules: [430 cpp, 27 css, 189 c, 50 Web, 310 csharpsquid, 341 typescript, 142 vbnet, 30 secrets, 328 javascript]
inputFiles: [
file:///C:/Users/cwdev/source/repos/myproj/myapp/mconsoleapp/Program.cs (UTF-8)
]
]

[DEBUG] [ThreadId 138] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Using native git blame
[DEBUG] [ThreadId 69] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Blamed 1 files in 156ms
[DEBUG] [ThreadId 173] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Start analysis
[DEBUG] [ThreadId 183] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Index files
[DEBUG] [ThreadId 183] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Language of file “file:///C:/Users/cwdev/source/repos/myproj/myapp/mconsoleapp/Program.cs” is detected to be “CS”
[DEBUG] [ThreadId 183] [SLCore] [sonarlint > Report about progress of file indexation] 1 file indexed
[DEBUG] [ThreadId 174] [SLCore] [org.reflections.Reflections > sonarlint-analysis-scheduler] Reflections took 11 ms to scan 1 urls, producing 24 keys and 257 values
[DEBUG] [ThreadId 145] [SLCore] [org.sonar.plugins.javascript.analysis.JsTsChecks > sonarlint-analysis-scheduler] Added 341 checks for language=‘ts’, repository=‘typescript’
[DEBUG] [ThreadId 145] [SLCore] [org.sonar.plugins.javascript.analysis.JsTsChecks > sonarlint-analysis-scheduler] Added 328 checks for language=‘js’, repository=‘javascript’
[DEBUG] [ThreadId 145] [SLCore] [org.sonar.plugins.javascript.analysis.AnalysisConsumers > sonarlint-analysis-scheduler] No registered JsAnalysisConsumer.
[DEBUG] [ThreadId 145] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Execute Sensor: SQVS-Roslyn
[DEBUG] [ThreadId 31] [Roslyn > Http Server] [Request 5f1be06d-3154-4789-8389-236d18891a6b] Received request http://localhost:45873/analyze
[DEBUG] [ThreadId 154] [Roslyn > Analysis > Configuration] Project Miscellaneous does not support compilation
[ThreadId 154] [Roslyn > Analysis > Configuration] No projects to analyze
[DEBUG] [ThreadId 154] [Roslyn > Http Server] [Request 5f1be06d-3154-4789-8389-236d18891a6b] Response code OK
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Execute Sensor: HTML
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] ‘JavaScript/TypeScript analysis’ skipped because there are no related files in the current project
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] ‘JavaScript inside YAML analysis’ skipped because there are no related files in the current project
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] ‘JavaScript inside HTML analysis’ skipped because there are no related files in the current project
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Execute Sensor: CSS Rules
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.javascript.analysis.CssRuleSensor > sonarlint-analysis-scheduler] No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] ‘CFamily’ skipped because there are no related files in the current project
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] ‘CFamilyTaintAnalysis’ skipped because there are no related files in the current project
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Execute Sensor: TextAndSecretsSensor
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.common.TextAndSecretsSensor > sonarlint-analysis-scheduler] Available processors: 8
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.common.TextAndSecretsSensor > sonarlint-analysis-scheduler] Using 8 threads for analysis.
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.secrets.configuration.SecretsSpecificationContainer > sonarlint-analysis-scheduler] SecretsStateContainer is already initialized, skipping re-initialization.
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.secrets.utils.CheckContainer > sonarlint-analysis-scheduler] ChecksContainer is already initialized, skipping re-initialization.
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.common.TextAndSecretsSensor > sonarlint-analysis-scheduler] Start fetching files for the text and secrets analysis
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.common.TextAndSecretsSensor > sonarlint-analysis-scheduler] Retrieving all except binary files
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.common.analyzer.Analyzer > sonarlint-analysis-scheduler] Starting the text and secrets analysis
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.common.MultiFileProgressReport > Progress of the text and secrets analysis] 1 source file to be analyzed for the text and secrets analysis
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > pool-77-thread-1] Initializing metadata of file file:///C:/Users/cwdev/source/repos/myproj/myapp/mconsoleapp/Program.cs
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.common.MultiFileProgressReport > Progress of the text and secrets analysis] 1/1 source file has been analyzed for the text and secrets analysis
[DEBUG] [ThreadId 168] [SLCore] [org.sonar.plugins.common.analyzer.Analyzer > sonarlint-analysis-scheduler] Analyzed files for the text and secrets analysis: 1
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Analysis detected 0 issues and 0 Security Hotspots in 209ms
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] AiCodeFix optional is present: false
[DEBUG] [ThreadId 168] [SLCore] [sonarlint > sonarlint-analysis-scheduler] Reporting 0 issues over 1 files for configuration scope myapp
[ThreadId 168] [Analysis] Analysis e73eba60-3bd1-4d42-ba11-baf1b87a30e3 found 0 issue(s) in Program.cs [final: True]
[DEBUG] [ThreadId 154] [LinkedFileAnalyzer] Starting affected files calculation for C:\Users\cwdev\source\repos\myproj\myapp\mconsoleapp\Program.cs

Okay this is interesting. That console project was in the same solution. I tried creating a brand new .net 8 console project and scanning worked. I then created a brand new .net framework 4.8 console project and it also worked. So whatever the issue is seems to somehow be specific to this larger solution with many projects. It’s only about 8 though.

In the new log, there is no issue with the file being not detected. There is another issue:

[DEBUG] [ThreadId 154] [Roslyn > Analysis > Configuration] Project Miscellaneous does not support compilation

Which may be caused if you open a file that is not part of any project (for example, via File > Open > File... menu)

There’s definitely something wrong with how the extension is getting the project information about the original solution, hence why it’s not even trying to analyze anything in that case. I will try to find some more time this week to figure out how to debug that problem

The only other thing I can think of is that all of the projects in the solution were upgraded in the past from .net framework 4.5 and 4.6 to the 4.8 they are now.

I need to clarify that sonarqube 9 does return results for .cshtml and .js files in my project, but nothing for .cs files.

Hi. Could you please install this version with additional logging and do the following steps:

  1. Install the custom build
  2. If not enabled, enable verbose logs in the SonarQube Options
  3. Restart the ide, open the solution
  4. Wait for the logs to stop the initial spam
  5. Open a csharp file, press Ctrl+S a few times
  6. Open another file (js or cshtml) and do the same
  7. Copy the full log and send it to us (can be via a DM to me, if you don’t want to share publicly)

Unfortunately the download is being blocked at about 99% by something in my system. Is it possible for you to package it as a vsix or provide it in some other way?

It’s a zip that has the VSIX inside (ci just packages it in ‘binaries’ archive for uniformity with other build types that we run, that produce extra files). Is the download still broken for you?

Sadly yes it’s still blocked any way I try it. The joys of corporate PCs…

Hi. Can you DM me your email so I can share a google drive link with you instead?

It’s ok I just managed to get it downloaded and installed. I’ll test it out and send logs in a while. How do I DM on here?

You can click on my profile and there should be a Message button

No message button that I can see.

Sorry, my bad, turns out it wasn’t allowed by default. I sent you a dm myself.

Hi Sonar team,

I have the similar issue.
I installed the newest version of the extensions for Visual Studio 2022, try to connect my SonarQube server and bind the project (before I imported my CA into TrustStore).

SonarQube plugin show no finding for my csharp code :frowning:.

I did some tests:

  • Issues are occures if I undbind the project.
  • I also tested plugin for VS Code with the same c# solution and it’s working without any problem.
  • Checked the detailed logs for SonarQube in VS2022:
    • no error or warning messages are occured
    • all http requests returns 200
    • events notifications are working without any problem
    • I found these debug messages in log (I don’t know if it is relevant)
[DEBUG] [ThreadId 39] [SLCore] [sonarlint > SonarLint Local Storage Synchronizer] GET 200 https://sonarqube.myserver.com/api/plugins/installed | response time=38ms
[DEBUG] [ThreadId 43] [SLCore] [sonarlint > SonarLint Local Storage Synchronizer] Downloaded plugin list in 44ms
[DEBUG] [ThreadId 43] [SLCore] [sonarlint > SonarLint Local Storage Synchronizer] [SYNC] Code analyzer 'csharp' does not support SonarLint. Skip downloading it.