MSBuild tasks running into a timeout with sonarqube extension

SonarQube Version: 7.9.1
SonarQube Extension Version: 4.8.0

When running a msbuild pipeline for a .net project containing sonarqube tasks, the pipeline permanently runs into a timeout, while other .net pipelines without the sonarqube taks are working fine.

6_Projektmappe Servicecenter.sln erstellen.txt (64.2 KB)


Are you using a Microsoft-hosted or a self-hosted agent ?


Our build environment is completely on-premise. So, yes we’re using a self-hosted agent.

This is the log of a failed build pipeline. Maybe it helps to resolve this issue.

Worker_20191009-135930-utc.log.txt (105.7 KB)

Hi @flyerwire

Is that possible for you to provide us the MSBuild log with either the binary log (and send us the *.binlog file that has been produced) with

msbuild.exe /bl

included or a diagnostic one ?

msbuild.exe -verbosity:diag

And, are you building a “DAL” project with some Entity migration inside ?
If yes, you might face this current issue :

Thank you.


And, are you building a “DAL” project with some Entity migration inside ?
If yes, you might face this current issue :

Yes, there is a legacy “DAL” project which is build with EntitySpaces inside my solution. I’ll try the workaround from the issue after creating the requested binary log.

Excluding the “DAL” project did the trick. Now all builds are doing fine.

But it seems that something went wrong in the case of a timedout build because building projects without the “DAL” project failed to build too.

1 Like

You mean that you have two msbuild tasks in your build pipeline, and then if the first one fail, the other one as well ?

Yes, but this affected every build-pipeline with sonar-qube tasks which got build on the same build machine. Regardles if its the same project or not.

So to me it looks like some kind of memory leak or something else.

Do you have the “Build in parallel” option checked in the Visual Studio build task ? If yes, can you try again without this option ?

No, its disabled for all build pipelines.

this a common issue, with Sonarqube and Build agents. For my team, we invested on a build server and built Build Agents as services, sorted the whole issue, the build agents are dedicated and not shared along apps, hosted agents are usually being shared, thats abad idea especially if you have CI/CD pipelines and Sonarqube scans

Hi, since the latest C# rule update my problem is back (regression?).
I’ve attached you the log of a failed build with sonar qube tasks:

You could try a local build , and pass to MSBuild /p:reportanalyzer=true /v:d - doing this you will find out which rules are taking most of the time during the build and then disable those rules for your specific projects.

We are interested as well in what is taking long, so we will highly appreciate if you’ll share the debug logs with the analysis time (we have some open tickets related to performance and any additional info will help once we’ll start working on them)

The strange thing is that local builds running fine and this only happens und our hosted build agents - until the build server ist rebooted.

@flyerwire both MSBuild and the C# compiler can spawn processes that keep running after the build has finished, which might be why a server reboot is required.

Could you try passing the following arguments to MSBuild to see if it makes a difference?
/p:UseSharedCompilation=false /nodeReuse:false