.NET analysis causes VStest to hang

Hi,

I’m analysing a large .NET 4.5 solution with a number of projects using Azure DevOps pipelines and the provided SonarCloud pipeline tasks.

When running x64 unit tests with VStest task, according to the logs all the tests run and pass, but the VStest task hangs and never completes (I’ve left it up to 12 hours after the last logs are produced). Looking at the build server, there seems to be a single testhost process left running.

This doesn’t happen without the SonarCloud scanner in place. Without the SonarCloud analysis the VStest task completes as expected. Also, if unit tests are not run, the Sonar analysis completes and published successfully.

What could be causing this behaviour and is there a way to resolve it? At the moment I can’t get any code coverage data in my analysis.

@GlenHarding - welcome to the community, and apologies for the delayed response.

That’s strange. The SonarScanner for .NET has hooks into the MSBuild step to execute the Sonar analyers during the build step, but there shouldn’t be any scanner/analyzer code executing once the build has finished.

MSBuild has a host process that can continue running post-build so some of the scanner assemblies could still be in-memory, but they shouldn’t be executing. You could try running the build step with -nr:false to see if that makes any difference.

Some other questions:

  • do the tests always hang at the same point i.e. is there a particular test that is causing the problem?
  • do the tests invoke MSBuild?