Performance problem with running dotnet analysis

Hi Julien!
Thank you so much for your attention to this topic. My team is using JetBrains Rider for work, and SonarQube on a build server. We have a pretty big solution with 46 projects and 600k lines of C# code. I have tried to install the SonarAnalyzer but it drastically affected a build performance. With the analyzer, build takes almost 10min and without it less than 3min. It is unacceptable performance and it makes SonarAnalyzer unusable in our project. We are looking forward to Rider support for SonarLint.

1 Like

Thanks for the feedback. SonarLint is usually only analyzing the current opened file, so it might be less visible in the end. But we would certainly like to investigate your issue, as it probably affects in a similar way the analysis of your project on SonarQube/SonarCloud.

If you are willing to help us improving our C# analyzer, I encourage you to create a new thread to not spam this one.

hi @vprokopenko

Thank you for reporting this performance issue.

How are you using SonarC# - as a standalone nuget or with the Scanner for MSBuild and a SonarQube instance?

What version of SonarC# are you using?

  • if you’re using it just as a standalone nuget, could you please run the build with msbuild /p:reportanalyzer=true /v:d > build.log and give us the results?
  • if you are using it with the Scanner for MSBuild, could you please also share the logs of the END step of the analysis ?

In both cases we’d like the msbuild logs as well (with /p:reportanalyzer=true) - we’re interested in the time-per rule, something like the below (but for all rules :slight_smile:)

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=, Culture=neutral, PublicKeyToken=c5b62af9de6d7244
448.313 50 SonarAnalyzer.Rules.CSharp.TokenTypeAnalyzer
445.228 49 SonarAnalyzer.Rules.CSharp.SymbolReferenceAnalyzer 

Thank you !