Azure Dev Ops / c# / Slow build times

Template for a good new topic, formatted with Markdown:

  • ALM used : Azure DevOps
  • CI system used : Azure DevOps
  • Languages of the repository: C#
  • Error observed: Extremely slow build times

We are trialing Sonar Cloud, and our build times have gone from 10 minutes, so not finishing after 2 hours.
I have tried disabling warning that appeared the most (Using clause which was unusued), but this doesn’t seem to have an impact.

All the threads on here about it reference bugs that look to be fixed.

I don’t really know where to start debugging or getting support. Is this expected behaviour? ITs about 150 cs projects, none of them very big.

Hi Tank104,

Welcome to the community support!

Could you clarify a little bit?
Are you saying that you build 150 projects C# and it went from 10 minutes to more than 120 minutes?

Does this mean you run SonarCloud analysis on each project?

If t’s the case and we consider the following:

  • the SonarCloud scanner scans every project = 150 analysis to perform
  • each analysis takes 1 minute to scan the code which is quite fast (but can be improved if the scope is reduced to the minimum) = 150 minutes of code analysis. Even with a 30 seconds step, the build time will be multiplied by 8.

At this scale, 150 projects, every new step which does something signififcant (and the scanner does look for a lot of things) will obviouly make the whole process longer.

Could you provide a couple of background task ids?

Thanks for using our product.

Best.

Hi Olivier,
A background task example is AXU0Gk3BKGBZPjxNtwmS

In our situation (where we have a big monolith), and the time is as expected - how often would you run analysis then? We wanted to run it on every Pull Request, so that we could see any warnings in the PR review stage - which I understand we can do. But with it adding 3 hours on, its just not feasible everytime.
We could run it once a week to review I guess…

Are there certain checks we can turn off to get the time taken right down?

Hi @tank104

Overhead is expected on the build step, no matter how many projects you have. But in your case, it’s certainly too much.

Would it be possible to share the build log (i’ll send you a PM) so that we can review it with our analyzers expert ?

Thanks in advance.
Mickaël

Hi @mickaelcaro,

I think we are having the same problem. We have a solution with 50+ projects with 2M+ loc and build duration increased from 15-20 minutes to 80-100 minutes after adding SonarCloud step to our Build Pipeline on Azure DevOps.
I would like to learn what happened with @tank104 's case. May be we can benefit from them.
Thanks in advance,
Best regards,

Hi @boyukbas,

unfortunately we did not get a response from @tank104 with the build logs and we don’t know exactly what the problem was.

I recommend to start a new thread with your issue and share with us the build logs while running the build with p:reportanalyzer set to true: msbuild /p:reportanalyzer=true /v:d > build.log. This will help us see which rules are taking longer than expected.

Thank you,
Costin

Sorry I have been on holiday, still on list - hopefully by end of week.
Also to confirm I did send build log to your colleague. We were just going to test the one project that is really slow, and see if I can send through to you.