# Coverage information not shown in SonarQube

**URL:** <https://community.sonarsource.com/t/coverage-information-not-shown-in-sonarqube/127460>\
**Category:** SonarQube Server / Community Build\
**Tags:** azuredevops, dotnet, coverage\
**Created:** [October 6, 2024, 8:26am UTC](https://community.sonarsource.com/t/coverage-information-not-shown-in-sonarqube/127460 "2024-10-06T08:26:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bfcamara](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/bfcamara/32/62752_2.png) [@bfcamara](https://community.sonarsource.com/u/bfcamara)\
**Post date:** [October 6, 2024, 8:26am UTC](https://community.sonarsource.com/t/coverage-information-not-shown-in-sonarqube/127460/1 "2024-10-06T08:26:13Z")

</div>

I have a pipeline in **Azure DevOps** that builds and run test in several **.NET 8 projects**. The code coverage information is being published correctly to Azure Devops but no information is being shown in Sonar ( **SonarQube Community 10.6** ). Here is the Azure Pipeline yaml definition using **SonarScanner for MSBuild 6.2**

```yaml
  - task: SonarQubePrepare@6
    inputs:
      SonarQube: 'SonarQube'
      scannerMode: 'MSBuild'
      projectKey: 'My_ProjectKey'
      projectName: 'CommsService'
      extraProperties: |
        sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/coverage.opencover.xml
        sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx

  - task: MSBuild@1
    displayName: Build
    inputs:
      solution: '**/*.sln'
      msbuildLocationMethod: 'location'
      msbuildArguments: '/t:Restore,Build'
      msbuildLocation: 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe'

  - task: DotNetCoreCLI@2
    displayName: Run Tests
    inputs:
      command: test
      projects: 'tests/**/*UnitTests.csproj'
      arguments: '--configuration ${{ parameters.BuildConfiguration }} --collect "XPlat Code coverage" --settings coverlet.runsettings'
      publishTestResults: true

  - task: SonarQubeAnalyze@6
    inputs:
      jdkversion: 'JAVA_HOME_17_X64'

  - task: SonarQubePublish@6
    inputs:
      pollingTimeoutSec: '300'

  - task: PublishCodeCoverageResults@2
    displayName: 'Publish code coverage report'
    inputs:
      summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.opencover.xml'

```

I am using **coverlet with msbuild** , and generating reports in **opencover** format.

In Azure DevOps I can see the coverage information

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/6/6/66ecb7bc69cf7205505f333e6d368d19eaac4a81.png)

But in Sonar, no coverage information is being shown

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/3/f/3ff47e035f77d9c973cb12209ba715812d38ae92.png)

From the logs I can see that Sonar finds the opencover and trx reports and both are being parsed. Here is part of the logs

```txt
...
2024-10-05T16:08:00.4689442Z 17:08:00.468 INFO: Sensor C# Tests Coverage Report Import [csharp]
2024-10-05T16:08:00.4693908Z 17:08:00.468 DEBUG: Analyzing coverage with wildcardPatternFileProvider with base dir 'D:\Agents\A1\_work\248\.' and file separator '\'.
2024-10-05T16:08:00.4704371Z 17:08:00.469 DEBUG: Pattern matcher extracted prefix/absolute path 'D:\Agents\A1\_work\_temp' from the given pattern 'D:\Agents\A1\_work\_temp\**\coverage.opencover.xml'.
2024-10-05T16:08:00.4705303Z 17:08:00.469 DEBUG: Gathering files for wildcardPattern '**\coverage.opencover.xml'.
2024-10-05T16:08:00.4716418Z 17:08:00.471 DEBUG: Pattern matcher returns '4' files.
2024-10-05T16:08:00.4722261Z 17:08:00.471 DEBUG: The current user dir is 'D:\Agents\A1\_work\248'.
2024-10-05T16:08:00.4723314Z 17:08:00.471 INFO: Parsing the OpenCover report D:\Agents\A1\_work\_temp\azagent_SWDC1MGMT03P_2024-10-05_17_07_39\In\SWDC1MGMT03P\coverage.opencover.xml
2024-10-05T16:08:00.5843696Z 17:08:00.583 DEBUG: CoveredFile created: (ID '1', path 'D:\Agents\A1\_work\248\s\src\MyFile1.cs', indexed as 'D:\Agents\A1\_work\248\s\src\MyFile1.cs').
...
2024-10-05T16:08:00.6115162Z 17:08:00.610 DEBUG: CoveredFile created: (ID '26', path 'D:\Agents\A1\_work\248\s\src\Project1\MyFileX.cs', indexed as 'D:\Agents\A1\_work\248\s\src\Project1\MyFileX.cs').
2024-10-05T16:08:00.6364335Z 17:08:00.630 INFO: Adding this code coverage report to the cache for later reuse: D:\Agents\A1\_work\_temp\azagent_SWDC1MGMT03P_2024-10-05_17_07_39\In\SWDC1MGMT03P\coverage.opencover.xml
2024-10-05T16:08:00.6365828Z 17:08:00.632 DEBUG: The current user dir is 'D:\Agents\A1\_work\248'.
2024-10-05T16:08:00.6367123Z 17:08:00.632 INFO: Parsing the OpenCover report D:\Agents\A1\_work\_temp\291e87f2-4daa-4128-9b59-7eb7aaaa0fe6\coverage.opencover.xml
2024-10-05T16:08:00.6371563Z 17:08:00.635 DEBUG: CoveredFile created: (ID '1', path 'D:\Agents\A1\_work\248\s\src\Project2\MyFile1.cs', indexed as 'D:\Agents\A1\_work\248\s\src\Project2\MyFile1.cs').
2024-10-05T16:08:00.6373224Z 17:08:00.636 DEBUG: CoveredFile created: (ID '2', path 'D:\Agents\A1\_work\248\s\src\Project2\MyFile2.cs', indexed as 'D:\Agents\A1\_work\248\s\src\Project2\MyFile2.cs').
2024-10-05T16:08:00.6391109Z 17:08:00.638 INFO: Adding this code coverage report to the cache for later reuse: D:\Agents\A1\_work\_temp\291e87f2-4daa-4128-9b59-7eb7aaaa0fe6\coverage.opencover.xml
2024-10-05T16:08:00.6392305Z 17:08:00.638 DEBUG: The current user dir is 'D:\Agents\A1\_work\248'.
2024-10-05T16:08:00.6393866Z 17:08:00.638 INFO: Parsing the OpenCover report D:\Agents\A1\_work\_temp\azagent_SWDC1MGMT03P_2024-10-05_17_07_16\In\SWDC1MGMT03P\coverage.opencover.xml
2024-10-05T16:08:00.6399952Z 17:08:00.639 DEBUG: CoveredFile created: (ID '1', path 'D:\Agents\A1\_work\248\s\src\Project2\MyFile1.cs', indexed as 'D:\Agents\A1\_work\248\s\src\Project2\MyFile1.cs').
2024-10-05T16:08:00.6405807Z 17:08:00.639 DEBUG: CoveredFile created: (ID '2', path 'D:\Agents\A1\_work\248\s\src\Project2\MyFile2.cs', indexed as 'D:\Agents\A1\_work\248\s\src\FProject2\MyFile2.cs').
2024-10-05T16:08:00.6418650Z 17:08:00.641 INFO: Adding this code coverage report to the cache for later reuse: D:\Agents\A1\_work\_temp\azagent_SWDC1MGMT03P_2024-10-05_17_07_16\In\SWDC1MGMT03P\coverage.opencover.xml
2024-10-05T16:08:00.6419687Z 17:08:00.641 DEBUG: The current user dir is 'D:\Agents\A1\_work\248'.
2024-10-05T16:08:00.6420623Z 17:08:00.641 INFO: Parsing the OpenCover report D:\Agents\A1\_work\_temp\406bd517-fd86-4607-a313-c6404f3f3d26\coverage.opencover.xml
2024-10-05T16:08:00.6427525Z 17:08:00.642 DEBUG: CoveredFile created: (ID '1', path 'D:\Agents\A1\_work\248\s\src\Project2\MyFile1.cs', indexed as 'D:\Agents\A1\_work\248\s\src\Project2\MyFile1.cs').
...
2024-10-05T16:08:00.6607274Z 17:08:00.658 DEBUG: CoveredFile created: (ID '26', path 'D:\Agents\A1\_work\248\s\src\Project2\MyFileN.cs', indexed as 'D:\Agents\A1\_work\248\s\src\Project2\MyFileN.cs').
2024-10-05T16:08:00.6658757Z 17:08:00.664 INFO: Adding this code coverage report to the cache for later reuse: D:\Agents\A1\_work\_temp\406bd517-fd86-4607-a313-c6404f3f3d26\coverage.opencover.xml
2024-10-05T16:08:00.6666488Z 17:08:00.665 DEBUG: Analyzing coverage after aggregate found '26' coverage files.
2024-10-05T16:08:00.6961289Z 17:08:00.693 DEBUG: The total number of file count statistics is '26'.
2024-10-05T16:08:00.7012359Z 17:08:00.699 INFO: Coverage Report Statistics: 26 files, 26 main files, 26 main files with coverage, 0 test files, 0 project excluded files, 0 other language files.
2024-10-05T16:08:00.7012999Z 17:08:00.700 INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=231ms
2024-10-05T16:08:00.7013633Z 17:08:00.700 INFO: Sensor C# Unit Test Results Import [csharp]
2024-10-05T16:08:00.7055024Z 17:08:00.701 DEBUG: Pattern matcher extracted prefix/absolute path 'D:\Agents\A1\_work\_temp' from the given pattern 'D:\Agents\A1\_work\_temp\**\*.trx'.
2024-10-05T16:08:00.7055667Z 17:08:00.701 DEBUG: Gathering files for wildcardPattern '**\*.trx'.
2024-10-05T16:08:00.7056086Z 17:08:00.703 DEBUG: Pattern matcher returns '2' files.
2024-10-05T16:08:00.7058702Z 17:08:00.704 DEBUG: The current user dir is 'D:\Agents\A1\_work\248'.
2024-10-05T16:08:00.7059340Z 17:08:00.704 INFO: Parsing the Visual Studio Test Results file 'D:\Agents\A1\_work\_temp\azagent_SWDC1MGMT03P_2024-10-05_17_07_39.trx'.
2024-10-05T16:08:00.7111784Z 17:08:00.706 DEBUG: Parsed Visual Studio Test Times - duration: 7625.
2024-10-05T16:08:00.7136435Z 17:08:00.709 DEBUG: Parsed Visual Studio Test Counters - total: 25, failed: 0, errors: 0, timeout: 0, aborted: 0, executed: 25.
2024-10-05T16:08:00.7138136Z 17:08:00.710 DEBUG: The current user dir is 'D:\Agents\A1\_work\248'.
2024-10-05T16:08:00.7138745Z 17:08:00.710 INFO: Parsing the Visual Studio Test Results file 'D:\Agents\A1\_work\_temp\azagent_SWDC1MGMT03P_2024-10-05_17_07_16.trx'.
2024-10-05T16:08:00.7139269Z 17:08:00.711 DEBUG: Parsed Visual Studio Test Times - duration: 3673.
2024-10-05T16:08:00.7143116Z 17:08:00.712 DEBUG: Parsed Visual Studio Test Counters - total: 10, failed: 0, errors: 0, timeout: 0, aborted: 0, executed: 10.
2024-10-05T16:08:00.7281293Z 17:08:00.716 INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=16ms
...

```

And at the end of the log

```txt
...
2024-10-05T16:08:00.9658377Z 17:08:00.964 INFO: Analysis report generated in 126ms, dir size=267.7 kB
2024-10-05T16:08:01.1084835Z 17:08:01.107 INFO: Analysis report compressed in 141ms, zip size=75.3 kB
2024-10-05T16:08:01.1086318Z 17:08:01.107 INFO: Analysis report generated in D:\Agents\A1\_work\248\.sonarqube\out\.sonar\scanner-report
2024-10-05T16:08:01.1087106Z 17:08:01.107 DEBUG: Upload report
2024-10-05T16:08:01.1180420Z 17:08:01.115 DEBUG: --> POST mysonar url (75586-byte body)
2024-10-05T16:08:01.2359544Z 17:08:01.229 DEBUG: <-- 200 (114ms, 76-byte body)
2024-10-05T16:08:01.2426483Z 17:08:01.236 INFO: Analysis report uploaded in 129ms
2024-10-05T16:08:01.2485298Z 17:08:01.236 DEBUG: Report metadata written to D:\Agents\A1\_work\_temp\sonar\5631\46071506-f0cc-5f09-0d61-92176b866f6d\report-task.txt
2024-10-05T16:08:01.2486979Z 17:08:01.236 INFO: ANALYSIS SUCCESSFUL, you can find the results at: mysonarurl
2024-10-05T16:08:01.2552262Z 17:08:01.236 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
2024-10-05T16:08:01.2553805Z 17:08:01.236 INFO: More about the report processing at mysonarurl
2024-10-05T16:08:01.2554905Z 17:08:01.236 DEBUG: Post-jobs : 
2024-10-05T16:08:01.2587270Z 17:08:01.252 INFO: Analysis total time: 11.231 s
2024-10-05T16:08:01.2605404Z 17:08:01.252 INFO: ------------------------------------------------------------------------
2024-10-05T16:08:01.2605938Z 17:08:01.252 INFO: EXECUTION SUCCESS
2024-10-05T16:08:01.2606468Z 17:08:01.252 INFO: ------------------------------------------------------------------------
2024-10-05T16:08:01.2699560Z 17:08:01.252 INFO: Total time: 13.200s
2024-10-05T16:08:01.3042537Z 17:08:01.299 INFO: Final Memory: 15M/60M
2024-10-05T16:08:01.3044856Z 17:08:01.299 INFO: ------------------------------------------------------------------------
2024-10-05T16:08:01.3105011Z 17:08:01.299 DEBUG: Cleanup org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda$357/0x000001f6812aca10@1b005a0b during JVM shutdown
...

```

I think have been following all the steps mentioned in the docs to make coverage information available for .NET project in Azure Devops pipelines. For some reason that I can’t figure out why, the coverage information is not being shown in Sonar.

Any help?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [October 7, 2024, 12:52pm UTC](https://community.sonarsource.com/t/coverage-information-not-shown-in-sonarqube/127460/2 "2024-10-07T12:52:22Z")

</div>

Hi,

Welcome to the community!

Could you post the full `debug` analysis log, redacted as necessary?

&nbsp;  
Thx,  
Ann

---

<div class="post-metadata">

**Author:** ![bfcamara](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/bfcamara/32/62752_2.png) [@bfcamara](https://community.sonarsource.com/u/bfcamara)\
**Post date:** [October 7, 2024, 1:27pm UTC](https://community.sonarsource.com/t/coverage-information-not-shown-in-sonarqube/127460/3 "2024-10-07T13:27:43Z")

</div>

Hi G Ann

Thank you for your help. In fact it’s working, and it was my fault. I was looking to the wrong place in Sonar. I should be looking into the “Overall Code” instead of the “New Code”. Everything is working as expected.
