C# analysis getting stuck during analysis

Hello Guys,

I am running analysis on C# solution with a couple of projects. The analysis gets stuck at the same point each time. I have identified one rule causing the issue but the issue is still there. I am suspecting another rule causing issue as well but going through hundreds of rules is 1. not an efficient solution and 2. not a wanted solution as that would only result in deactivation of the rules.

My question here is if there is any way to better debug issue to see where exactly it is getting stuck during the analysis. sonar.verbose=true does not help much at this point.

The setup is following - 4CPU cores, 8GB ram, Windows server 2019, Visual Studio build tools 2019
The setup where it seems to be working - 2CPU cores, 8GB ram, Windows 10, Visual Studio 2017

Thank you for any suggestions,

Update on this.
Looks like the issue is with the use of MSBuild 16 (for vs 2019) … all is good with MSBuild 15 (for vs 2017).
I tried this with latest version of SQ as well as Sonar Scanner for MS build.

Is there any know issue with analysis of projects built on MSBuild 16?

By drilling down the option I came to conclusion that issue is due to running analysis during the build with MSBuild 16. MSBuild 15 is running without issues.

There are 3 rules that cause the issue (when disabled the analysis goes ahead without issues.)

These are three rules causing troubles:

  • csharpsquid:S1144
  • csharpsquid:S3444
  • csharpsquid:S4487


  • SQ: 8.4.2 (build 36762)
  • C# plugin: 8.9
  • Sonar scanner for MSBuild: 4.9 and 4.10

Unfortunately I was not able to reproduce the issue on a dummy code and I cannot provide the code which encounters this issue.

Ahoj Kubo,

There were several questions listed, I’ll try to answer them one by one.

There’s no easy way to measure time taken by individual rules. We’d like to improve that in the future.

Do you have Entity Framework migration files in your project? We’ve recently fixed a major performance issue related to S1144 and S4487 that was released in SQ 8.5.

Can you try to update your SQ to 8.5 and see if the issue persists?

Contrary to that, S3444 should be cheap one. Can you try to verify your findings only with S3444 activated?

We’re currently not aware of any MSBuild 16 build issues and we’d like to get more information on the topic if the update to SQ 8.5 will not help.


sonar.verbose=true helps with logs during the END step.

Like Pavel said, there isn’t a way to tell how much time individual rules take during an unfinished build. However, to see how long each roslyn rule takes during a successful build, you should use the reportanalyzer msbuild parameter like below:

msbuild /p:reportanalyzer=true /v:d > build.log

The /v:d msbuild argument is for logs verbosity.

Like Pavel said, first please run the msbuild 16 analysis with all rules enabled with Sonarqube 8.5.

If the problem with msbuild 16 persists, please run the analysis in verbose mode for both msbuild 15 and 16 (both with SQ 8.5) and send us the logs (via a private message if you prefer).


1 Like

Hello Guys,

thank you so much for such a quick reaction. It is really appreciated.

So a couple of things:

  • I tested everything also with latest version of SQ that was available for download on Friday. The result is exactly the same. All three rules cause the same issue. I tried also testing the rules one by one. Still the same.
  • Yes the project does use Entity Framework. Using latest SQ did not help though.
  • I ran built with MSBuild 16 (just to the point where it gets stuck) and 15 and created the log as you requested Andrei. I do not seem to be able to send private messages though. (I am new on this forum, maybe I am missing something).

Thank you,

I’ve sent you a private message. You can check it at https://community.sonarsource.com/u/Jakub_Papcun/messages (unfortunately not available via the UI)