It takes a long time to scan a .net core project

  • SonarQube 7.4
  • Scanner SonarScanner for MSBuild 4.6 (Using the .NET Core version of the Scanner for MSBuild)

Hi,
We have been use SonarQube for a while. And until this time there was no problem with scanning.
Now we have a problem with a project. This project size is about 60k. This project have been scanned with no problem until now. When we want to scan the same project, scan time is getting longer(over 30~45 minutes) and scanning does not end.
There are another project with same size and have a lots of bug, but it’s scanning time is not’t so long as this project. It takes only about 4~5 minutes.
I don’t know what is the problem. There is nothing in the log to fing the issue. I scan the project with 2 rule, time is running out.


#bug:fault

hello @ckonca and thanks for raising this issue

What exactly changed? Did this happen after updating SonarQube to a newer version? I understand from you that at Time A, you were scanning this project with no problems and at Time B this performance issue occurred. What happened between Time A and Time B?

What do you mean you scan the project with 2 rule?

To debug, we really need the verbose logs of the build and the scan to understand what’s happening.

  • to enable verbose logging for the scan, add /d:sonar.verbose=true (e.g. SonarScanner.MSBuild.exe begin /k:"MyProject" /d:sonar.verbose=true) to the BEGIN step and then share with us the logs from the END step

  • to get verbose analyzers diagnostics from the BUILD step, please add /p:reportanalyzer=true and /v:d (e.g. msbuild /p:reportanalyzer=true /v:d) and share with us the build logs

If sharing the build logs is not an option, we need the time taken by each analyzer (i.e. rule)

Total analyzer execution time: 893.913 seconds.
NOTE: Elapsed time may be less than analyzer execution time because analyzers can run concurrently.
Time (s) % Analyzer
893.913 100 SonarAnalyzer.CSharp, Version=7.13.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244
448.313 50 SonarAnalyzer.Rules.CSharp.TokenTypeAnalyzer
445.228 49 SonarAnalyzer.Rules.CSharp.SymbolReferenceAnalyzer 
.....

See this similar thread: SonarCloud taking over one hour to analyze on DevOps - #11 by Andrei_Epure

Hi @Andrei_Epure,

Actually, there is no change with SonarQube, no upgrade, no new thing. Changes are related to new codes. The project grows with new codes.

I enabled this property.

And these features as well. Now there are too many logs in which I get lost :slight_smile:
The solution contains several .csproj. I guess it takes a long time while scanning some projects.
I will share with you some screen shot.

I know you will say this time is no long. But before, this solution’s scanning time was being taked only 3-5 minutes.

Thank in advance.

If you have many projects, it’s worth verifying each. You gave 2 screenshots: one with a project that takes 3 minutes to analyze, and another with a project that takes 13 minutes - that’s a big difference. Most of the time is probably spent on analyzing a small set of projects, and you should look into what takes time inside those analyses.

From what I see S1144 - UnusedPrivateMember is taking a longer time that the rest. You can try and disable this rule from the quality profile and see the overall impact.

Update: we’ve fixed the performance problem we were having with the UnusedPrivateMember rule (#2474 ). The fix is included in the 8.13 release.

1 Like

Hi Andrei Epure,

Thank you for the information.
We will test it with upgrade.
We now use SonarQube 8.1.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.