Unable to get code coverage for one of the dotnet project in sonar cloud

Hi,

We are unable to see the code coverage for one of the dotnet project, hence the same method is being used for other dotnet projects it worked as expected and we are able to see code coverage in sonar cloud.

Please help us resolving the existing issue.

What do the logs say about importing code coverage?

We are using the below properties in the advances tab of prepare sonar analysis.

extraProperties: |
sonar.exclusions=/obj/,/*.dll
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/
/coverage.opencover.xml
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx

In dotnet test task we are able to see the results but unable to see updates on sonar.

We are using Sonarcloud plugin in Azure devops and it is set to run with ‘Integrate with MS Build’ and these are the properties we are configuring -
extraProperties: |
sonar.exclusions=/obj/,/*.dll
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/
/coverage.opencover.xml
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx

Here’s the order of things -

  1. Prepare SonarCloud configuration
  2. dotnet build
  3. dotnet test - This task is running the test cases and outputting a .trx file into a temp directory. Output -

Results File: /home/vsts/work/_temp/_fv-az419-859_2023-06-14_11_32_01.trx

  1. Run code analysis - The logs show that the same trx file is being picked up by the scanner. Output -

INFO: Parsing the Visual Studio Test Results file ‘/home/vsts/work/_temp/_fv-az419-859_2023-06-14_11_32_01.trx’.

We have the same configuration setup on other projects and it works fine so we are just lost here. Appreciate your help.

As mentioned in the previous post, I’m mostly interested in what the logs say around here in the scanner logs: C# Tests Coverage Report Import