SonarLint binding freezes VS2017 - how to troubleshoot?


(Sasa Aleksandric) #1

Hi, everyone in my team has problem while binding VS solution to the SonarQube server - the solution freezes and binding is not finished. Is there a way to troubleshoot this?

The binding starts fine … I can see the following in the output window:

Initializing the telemetry package…
Finished initializing the telemetry package…
Initializing the daemon package…
Finished initializing the daemon package.
Checking for suppressions…
Checking for unbound projects.
66 unbound projects were found (…)

Number of suppressions found: 0
Initializing the notifications package…
Loading notifications settings…
Connected: checking for notifications
Finished initializing the notifications package
Notifications are not supported on this version of SonarQube
Connecting to SonarQube server: http://*************:9000/
Connecting to SonarQube server: Validating credentials
Connecting to SonarQube server: Retrieving organizations
Connecting to SonarQube server: Detecting server plugins
Discovered a supported plugin: Language: ‘C#’, Minimum version: ‘5.0’
Discovered a supported plugin: Language: ‘VB.NET’, Minimum version: ‘3.0’
Connecting to SonarQube server: Retrieving projects
Connecting to SonarQube server: Succeeded
Checking for suppressions…
Connecting to SonarQube server: Downloading server settings.
Number of suppressions found: 0
Updating binding…
Binding solution to SonarQube project: Started
Binding solution to SonarQube project: Discovering solution projects
Included projects:

Excluded projects:

You can change the exclusion options via the SonarLint project-level context menu i.e. Solution Explorer -> Select project(s)
Binding solution to SonarQube project: Download quality profile(s):
Successfully downloaded quality profile. Name : ‘Sonar way’, Key: '********************, Language: ‘C#’
INFO: SonarLint connected mode no longer installs the analyzers NuGet packages. The analyzers embedded in the VSIX are used instead.
Binding solution to SonarQube project: Generating project rule sets.

I can see the .sonarlint folder and generated ruleset file in it. I can also see individual ruleset files for each project. However, VS2017 is frozen up to 20min (that is longest I was waiting before killing the process), and nothing else is written in the output window, progress bar in the sonarqube extension doesn’t move. What is supposed to happen next, after individual project ruleset files were generated? What are the indicators that the solution is properly bound?

I really appretiate help with this. We are trying to evaluate if we could use SonarQube + SonarLint company-wide for the code quality control. It is essential to have SonarLint working properly.

(Sasa Aleksandric) #2

So, not much help here …

In the meantime, i have debugeed the SonarLint source code i found in GitHub and it looks as if ProjectItems.AddFromFile call dies for large project files. I have two of them that are 150Kb+ and adding a rule file to any of them using AddFromFile freezes Vs2017 forever (forever being equal to 2.5h - that long i’ve waited the last time i tried it)

Do you guys know any workaround which wouldn’t require bringing the size of project files down, or excluding them from the solution?

Thank you

(Duncan Pocklington) #3

Thanks for investigating. You could try manually adding the reference to the ruleset to those large project files, following the same pattern as it uses for other projects. SonarLint should detect that the generated ruleset file is already referenced and not try to add it again.