I’m using Visual Studio 2019 16.11 and the Sonar Lint extension 4.37.0.34839
The code base is very old and so many issues are found while scanning. There are files, that slow down so much, that it is impossible to work on them, since Sonar Lint periodically scans those files listing hundreds of warnings and infos every few seconds. Every few seconds VS2019 stops, isn’t reacting anymore while Sonar Lint works with one of this critical files.
I took a look at the most often harmed rules and if those are “harmless” or won’t change anything in our way to develop, I deactivated those rules. But this didn’t really help to be able to work on those mentioned files.
I tried to find a possibility to exclude such problematic files temporarily, but had no success
So - what to do?
Yes, work on those files, to change them to be really better in the code quality.
But my job is not this one, but to develop functionality and I can’t, if VS2019 stops reacting periodically.
If the languages that are causing you problems are C# or VB.NET then the analysis is controlled by Visual Studio, and you can use the normal VS mechanisms to limit what is analysed (e.g. changing the Background analysis scope in Tools, Options).
Could you try upgrading to the latest version (v4.38) please? I wouldn’t necessarily expect it to make much difference, but we did make a few changes to move some processing off the UI thread.
Unfortunately, there isn’t a way to exclude individual files from analysis.
FYI the actual analysis is done by a separate process, so the work in VS is limited to collecting the configuration information necessary to trigger the analysis, and rendering the results. Also, a file is only analysed when it is opened or saved.
A couple more questions to help with troubleshooting the root cause:
are you seeing the delays only when opening/saving, or at other times too e.g. when changing tabs?
how many LOCs do the “problem” files have, and how many issues are reported?
I hoped the installed extension would update automatically. But yes, I’ll update Sonar Lint.
I hoped there would be a way to exclude individual files, since our code base has for sure after 30y working on/with it more than one file, which exceeds the “limits”.
To your question:
I experience the delays while working, while editing, not while opening or saving.
Reading the docs I expected, too to have such delays only while opening or saving, but … no … while editing. And having not saved, only editing the file, regulary in the status bar was to read something like “Sonar Lint finished scanning” (or similar).
The specific file had, after excluding several rules, I would not discuss with my team, ca 400 warnings and 400 information messages in ca. 11530 LOC.
Since there is no way to exclude individual files, I will need to deactivate the extension and activate it if I want to use it.
Since our code base is such old any static code checker applying modern rules will list tons of issues.
No matter if we have the time to work on the issues or just do care for the new code to be “compliant”.
So - isn’t there a way to give Sonar Lint in the standalone mode for C++ this desired exclusion feature?
Auto-update: Visual Studio should auto-update the extension if you have configured it to do so. It isn’t something that extension authors have any control over.
Can you generate reproducer files for the file that leads to the crash?
This might help us investigate the reason behind the crash.
Does the crash happen consistently when analyzing a specific file?
I needed to disable the extension Sonar Lint to continue working fluently.
Now I enabled Sonar Lint and produced the reproducer file, but …
… the file contains intellectual property of my employer and I’m sure, that I don’t have the allowance to send this file to you.
Does the crashing “sub process” leave some traces, some crash information, some bread crumbs to collect somewhere in its environment or in the system (OS), like in the event viewer?
Unfortunetly, no… It contains all these details to be able to reproduce the same problem you are facing on our side. Will you be able to share it privately?