Code Coverage is not shown in the SonarCloud.io

Hi,

We have several projects in SonarCloud.io (Pay mode) showing code coverage results, but we have problems with one of them.

We are generating an opencover file:

<?xml version="1.0" encoding="utf-8"?> DataFactory.CustomActivities.Common.dll 2019-10-04T11:01:26 DataFactory.CustomActivities.Common

…

Ans the scanner is adding this file

INFO: Sensor C# Tests Coverage Report Import [csharp]
INFO: Parsing the OpenCover report /home/vsts/work/1/./s/***/results/coverage.opencover.xml
INFO: Adding this code coverage report to the cache for later reuse: /home/vsts/work/1/./s/*/results/coverage.opencover.xml
INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=107ms
INFO: Sensor C# Unit Test Results Import [csharp]
INFO: Parsing the Visual Studio Test Results file /home/vsts/work/1/./s/
+
/builds/.test-results/_4336933ca612_2019-10-04_11_01_23.trx
INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=67ms

But in SonarCloud.io teh results of Code Coverage is always 0%.

Can you help us to resolve this annoing problem?

Regards!

7 Likes

Hi
Sorry for the delay, @luru

  • Can you share the logs again, because we’ve added more logging in the SonarCSharp plugin since you initially posted this problem?
  • Can you share the diagnostic logs - the verbose output of the command (please run SonarScanner.MSBuild.exe begin /k:β€œMyProject” /d:sonar.verbose=true as the begin step, and please attach the output of END step)
  • Can you share the coverage file?

any update on this, @luru?

Hi Andrei,

Thanks for looking into this.

I’m going to reply for @luru.

As a side note, we have our test running on a docker container, however the path reference seems to be correct and the scan can find the files. After that, it will start ignoring all the files

The exclusion rules are the following, there are no additional exclusions in the Sonarcloud side:

extraProperties: |
sonar.exclusions=/test
sonar.cs.opencover.reportsPaths=
/results/coverage.opencover.xml
sonar.cs.vstest.reportsPaths=**/results/coverage.opencover.xml
sonar.coverage.exclusions="*Tests.cs"

The working dir is this one, it seems to be pointing to but can find files:

020-01-27T17:52:41.6872221Z 17:52:41.686 INFO: Importing 2 Roslyn reports
2020-01-27T17:52:41.8228277Z 17:52:41.822 INFO: Sensor C# [csharp] (done) | time=674ms
2020-01-27T17:52:41.8231835Z 17:52:41.823 INFO: Sensor C# Tests Coverage Report Import [csharp]
2020-01-27T17:52:41.8262059Z 17:52:41.823 DEBUG: Analyzing coverage with wildcardPatternFileProvider with base dir β€˜/home/vsts/work/1/.’ and file separator β€˜/’.
2020-01-27T17:52:41.8271918Z 17:52:41.826 DEBUG: Pattern matcher extracted prefix/absolute path β€˜/home/vsts/work/1/.’ from the given pattern β€˜/results/coverage.opencover.xml’.
2020-01-27T17:52:41.8277597Z 17:52:41.827 DEBUG: Gathering files for wildcardPattern '
/results/coverage.opencover.xml’.
2020-01-27T17:52:41.8916016Z 17:52:41.891 DEBUG: Pattern matcher returns β€˜1’ files.
2020-01-27T17:52:41.8920706Z 17:52:41.891 DEBUG: The current user dir is β€˜/home/vsts/work/1’.
2020-01-27T17:52:41.8925099Z 17:52:41.892 INFO: Parsing the OpenCover report /home/vsts/work/1/./s/{Redacted}/results/coverage.opencover.xml

Then it ignores them:

DEBUG: Skipping the fileId β€˜2’, line β€˜31’, vc β€˜1’ because file β€˜/home/vsts/work/1/{Redacted}/System/AnalyticsService.cs’ is not indexed or does not have the supported language.
DEBUG: Skipping the fileId β€˜2’, line β€˜32’, vc β€˜1’ because file β€˜/home/vsts/work/1/{Redacted}/System/AnalyticsService.cs’ is not indexed or does not have the supported language.
DEBUG: Skipping the fileId β€˜2’, line β€˜33’, vc β€˜21’ because file β€˜/home/vsts/work/1/{Redacted}/System/AnalyticsService.cs’ is not indexed or does not have the supported language.
DEBUG: Skipping the fileId β€˜2’, line β€˜34’, vc β€˜9’ because file β€˜/home/vsts/work/1/{Redacted}/System/AnalyticsService.cs’ is not indexed or does not have the supported language.

However, we don’t have any further ignore rules in the project configuration.
Attached the Code Analysis Logs with the verbose command enabled as requested.

TaSonarcloud_Scan_Verbose.txt|attachment (857.4 KB)