- Operating system:Ubuntu-based container on Apple Silicon Mac
- SonarLint plugin version: 4.10
- Programming language you’re coding in: C# primarily
- Is connected mode used:
- Connected to SonarCloud or SonarQube (and which version):
And a thorough description of the problem / question:
We recently added SonarLint to our devcontainers for our primary C# repository. On our Macs, the extension bogs down the system after a period of time. I can’t pinpoint the trigger, but disabling the extension does fix the issue.
What appears to be happening is that the extension generates 5 concurrent searches in VS Code, which then spawns a process ripgrep/bin/rg
for each. These all take a relatively long time to complete. Notably, they all seem to be for Razor templates, .cshtml files. Something, perhaps a build, triggers a new set of these searches and they accumulate to the point where operations in VS Code all hang.
I hit this problem myself while writing tests. Each change requires a rebuild and eventually, just trying to run the tests takes minutes.
My initial searches turned up performance issues with ripgrep in VS Code with suggestions to disable following symlinks. We don’t actually have symlinks, though the source IS mounting from the host into the container, but regardless, changing the setting did nothing.
Hi there, @Tyson_Stewart, welcome to Sonar Community!
Thanks a lot for your report and especially for being so thorough! Please be assured that we take performance issues very seriously, and as you can imagine, they can be quite tricky to reproduce.
If possible, could you please
- Enable verbose logging
- Add
"sonarlint.trace.server": "verbose",
line to your VSCode User Settings
- Share the logs with us Should you prefer not to share logs publicly, please ping here and I can initiate a private conversation here in the Community.
Thanks again and all the best,
Sophio
1 Like
Thank you! I have captured some logs and I would prefer not to share them publicly. Send me a DM when you can. Please note that I will be unavailable starting tomorrow until Monday in case we can’t connect today.
1 Like
Hello,
I am coming back to this post with a public summary of what we found. After investigating logs and some further observation by @Tyson_Stewart, we found that the performance degradation happens when SonarLint and the Microsoft C# extension are used together. This is because the Microsoft C# extension performs search and triggers textDocument/didOpen
notifications for all .cshtml
files in the project. For large projects, the number of such notifications can be large.
And, due to a recent (August 2024) change in SonarLint for VS Code, all didOpen
notifications will trigger an analysis regardless of whether the file is open in the editor.
A temporary workaround for the user was to exclude .cshtml
files from SonarCloud analysis (since they are in Connected Mode). This is obviously not a good option, as it prevents valid Sonar analysis from being performed on the files.
As a more permanent solution, we plan to:
For the performance issues caused by the search of the files itself (linked above), I suggest opening an issue for the Microsoft C# extension.
Thanks a lot for your collaboration and time, and for all the logs @Tyson_Stewart
All the best,
Sophio and the team
1 Like