The build’s duration of a specific project is approximately 4 minutes when one of its .cs file has 17k LOC (lines of code). However, after changing it to 40k LOC, the duration increase to almost 20 minutes! The only difference is the increase on this .cs file. I have reproduced this behavior and see it: if I change the LOC to 17k the duration comes back to 4 minutes. If it has 40 LOC, the build time increase to 20 minutes.
To be sure that it is related to Sonar, I had removed the SonarPrepareAnalysis from my pipeline and run again my build. So, I noted that the build takes just 30s without Sonar tasks.
Hello @marceloabreu and welcome to our community forum!
Please accept my apologies for the late reply, this slipped under our radar.
We are aware that our analysis doesn’t work very well on very large files. We recently made a change ( #4318) to improve performance when very large files are present, and it will be included in our next sonar-dotnet release (in 2-3 weeks).
Just to be sure that this fix will make your life easier once it gets deployed, could you please measure the Roslyn analyzers performance for the two scenarios (file with 17k LOCs, file with 40k LOCs) and share them with us?
To do that, after the BEGIN step, when building, use the reportanalyzer MSBuild parameter
msbuild /p:reportanalyzer=true /v:d > build.log
If you want to share them privately, I can send you a private message.