# SonarQube doesn't display code coverage but shows unit tests count

**URL:** <https://community.sonarsource.com/t/sonarqube-doesnt-display-code-coverage-but-shows-unit-tests-count/65141>\
**Category:** SonarQube Server / Community Build\
**Tags:** aws, msbuild, sonarqube, dotnet, coverage\
**Created:** [June 21, 2022, 6:39am UTC](https://community.sonarsource.com/t/sonarqube-doesnt-display-code-coverage-but-shows-unit-tests-count/65141 "2022-06-21T06:39:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajesh-panchal](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/rajesh-panchal/32/34399_2.png) [@rajesh-panchal](https://community.sonarsource.com/u/rajesh-panchal)\
**Post date:** [June 21, 2022, 6:39am UTC](https://community.sonarsource.com/t/sonarqube-doesnt-display-code-coverage-but-shows-unit-tests-count/65141/1 "2022-06-21T06:39:29Z")

</div>

- Version: Community Edition - Version 8.9.7
- I’ve prepared .coverage file, codecoverage.xml and .trx file and publishing to sonarqube server but still code coverage is not getting displayed. It shows unit tests count properly.
- I’ve tried certain online articles and it seems I have set up the reports path properly but somehow it’s not showing code coverage.

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

Below is the command I am running on aws machine.

```auto
SonarScanner.MSBuild.exe begin /k:"XXX" /v:"88" /n:XXX /d:sonar.host.url=XXX /d:sonar.login=XXX /d:sonar.skipPackageDesign=true /d:sonar.skipDesign=true /d:sonar.exclusions="*.xml" /d:sonar.verbose="true" /d:sonar.vbnet.vscoveragexml.reportsPaths="XXX\xyz.xml" /d:sonar.vbnet.vstest.reportsPaths="XXX\abc.trx"
 
MSBuild.exe projectname.sln /p:Configuration=Release /p:Platform="x86"
  
CodeCoverage.exe collect /output:***\code.coverage vstest.console.exe abc.dll /Settings:XXX\CodeCoverage.runsettings /logger:"trx;LogFileName=abc.trx" /Tests:SomeUnitTestMethods 

CodeCoverage.exe analyze /output:XXX\codecoverage.xml XXX\code.coverage
  
SonarScanner.MSBuild.exe end /d:sonar.login=XXX

```

Please help me to resolve the issue. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [June 21, 2022, 8:33am UTC](https://community.sonarsource.com/t/sonarqube-doesnt-display-code-coverage-but-shows-unit-tests-count/65141/2 "2022-06-21T08:33:12Z")

</div>

Hey there.

What do the logs from `SonarScanner.MSBuild.exe end` say? The relevant logs would start around here:

`INFO: Sensor C# Tests Coverage Report Import [csharp]`

---

<div class="post-metadata">

**Author:** ![rajesh-panchal](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/rajesh-panchal/32/34399_2.png) [@rajesh-panchal](https://community.sonarsource.com/u/rajesh-panchal)\
**Post date:** [June 21, 2022, 9:37am UTC](https://community.sonarsource.com/t/sonarqube-doesnt-display-code-coverage-but-shows-unit-tests-count/65141/4 "2022-06-21T09:37:52Z")

</div>

```auto
2022-06-21T09:25:28.7742865Z 09:25:28.663 DEBUG: Sensors : CSS Rules -> JaCoCo XML Report Importer -> C# Project Type Information -> C# Properties -> JavaXmlSensor -> HTML -> XML Sensor -> VB.NET Project Type Information -> VB.NET Properties
2022-06-21T09:25:28.7743944Z 09:25:28.663 INFO: Sensor CSS Rules [cssfamily]
2022-06-21T09:25:28.7744751Z 09:25:28.663 INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
2022-06-21T09:25:28.7745242Z 09:25:28.663 INFO: Sensor CSS Rules [cssfamily] (done) | time=0ms
2022-06-21T09:25:28.7745684Z 09:25:28.663 INFO: Sensor JaCoCo XML Report Importer [jacoco]
2022-06-21T09:25:28.7746394Z 09:25:28.663 INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
2022-06-21T09:25:28.7747410Z 09:25:28.663 INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
2022-06-21T09:25:28.7748179Z 09:25:28.663 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
2022-06-21T09:25:28.7748872Z 09:25:28.663 INFO: Sensor C# Project Type Information [csharp]
2022-06-21T09:25:28.7749346Z 09:25:28.663 INFO: Sensor C# Project Type Information [csharp] (done) | time=0ms
2022-06-21T09:25:28.7750011Z 09:25:28.663 INFO: Sensor C# Properties [csharp]
2022-06-21T09:25:28.7750905Z 09:25:28.663 DEBUG: Project 'XXX:XXX:014DCBEC-A772-4B1E-AE43-68B44C8838DF': Property missing: 'sonar.cs.analyzer.projectOutPaths'. No protobuf files will be loaded for this project.
2022-06-21T09:25:28.7751956Z 09:25:28.663 DEBUG: Project 'XXX:XXX:014DCBEC-A772-4B1E-AE43-68B44C8838DF': No Roslyn issues reports have been found.
2022-06-21T09:25:28.7752751Z 09:25:28.663 INFO: Sensor C# Properties [csharp] (done) | time=0ms
2022-06-21T09:25:28.7753399Z 09:25:28.663 INFO: Sensor JavaXmlSensor [java]
2022-06-21T09:25:28.7754350Z 09:25:28.663 INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
2022-06-21T09:25:28.7754775Z 09:25:28.663 INFO: Sensor HTML [web]
2022-06-21T09:25:28.7755387Z 09:25:28.678 INFO: Sensor HTML [web] (done) | time=15ms
2022-06-21T09:25:28.7756262Z 09:25:28.678 INFO: Sensor XML Sensor [xml]

```

Is this what you are asking to me share? I am using this property to share the report - `sonar.vbnet.vscoveragexml.reportsPaths=""` in command.

To be honest, I am new to this so not having much idea. Do I need to use any XML report importer?

Please guide. Thanks

---

<div class="post-metadata">

**Author:** ![rajesh-panchal](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/rajesh-panchal/32/34399_2.png) [@rajesh-panchal](https://community.sonarsource.com/u/rajesh-panchal)\
**Post date:** [June 21, 2022, 9:47am UTC](https://community.sonarsource.com/t/sonarqube-doesnt-display-code-coverage-but-shows-unit-tests-count/65141/5 "2022-06-21T09:47:21Z")

</div>

I think you are asking for this log,

```auto
2022-06-21T09:25:56.7708193Z 09:25:56.724 INFO: Found 5 MSBuild VB.NET projects: 4 MAIN projects. 1 TEST project.
2022-06-21T09:25:56.7708617Z 09:25:56.724 INFO: Sensor VB.NET [vbnet] (done) | time=23811ms
2022-06-21T09:25:56.7709024Z 09:25:56.724 INFO: Sensor VB.NET Tests Coverage Report Import [vbnet]
2022-06-21T09:25:56.7709700Z 09:25:56.724 DEBUG: Analyzing coverage with wildcardPatternFileProvider with base dir 'XXX\actions-runner-win-x64-2.287.1\_work\abc\.' and file separator '\'.
2022-06-21T09:25:56.7710839Z 09:25:56.724 DEBUG: Pattern matcher extracted prefix/absolute path

```

`Did not find deterministic source path in 'D:\abc\_work\xyz\foldername\XXX\My Project\Settings.Designer.vb'. Will skip this coverage entry. Verify sonar.sources in .sonarqube\out\sonar-project.properties.`

Is this something breaking?

```auto

2022-06-21T09:25:56.7884035Z 09:25:56.755 DEBUG: Skipping 'D:\actions-runner\actions-runner-win-x64-2.287.1\_work\aaa\aaa\aaa\aaa\aaa\AllFormsTester.vb' as it is a test file.

```

@Colin ,

I have also got this line. But the code is there so what could be wrong?

Also what is the meaning of this line?

`2022-06-21T09:25:56.7904399Z 09:25:56.755 INFO: Coverage Report Statistics: 9 files, 0 main files, 0 main files with coverage, 9 test files, 0 project excluded files, 0 other language files.`

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [June 21, 2022, 12:23pm UTC](https://community.sonarsource.com/t/sonarqube-doesnt-display-code-coverage-but-shows-unit-tests-count/65141/6 "2022-06-21T12:23:45Z")

</div>

It looks like all of the files found in your coverage report are being indexed as test files.

What version of the Scanner for .NET are you using?

---

<div class="post-metadata">

**Author:** ![rajesh-panchal](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/rajesh-panchal/32/34399_2.png) [@rajesh-panchal](https://community.sonarsource.com/u/rajesh-panchal)\
**Post date:** [June 21, 2022, 12:26pm UTC](https://community.sonarsource.com/t/sonarqube-doesnt-display-code-coverage-but-shows-unit-tests-count/65141/7 "2022-06-21T12:26:16Z")

</div>

I am using this version - MSBuild.SonarQube.Runner.Tool.4.8.0

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [June 22, 2022, 8:07pm UTC](https://community.sonarsource.com/t/sonarqube-doesnt-display-code-coverage-but-shows-unit-tests-count/65141/8 "2022-06-22T20:07:04Z")

</div>

Hey there.

Let me suggest that you upgrade to the latest version of the [SonarScanner for .NET](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/), _v5.7.1_. _v4.8_ was released almost 2.5 years ago.
