Dotnet sonarscanner send dotcover html report but no report is displayed on the web interface

Hello,

I have setup dotnet sonarscanner for my opensource project, in the build log it says that it picked up the report:

INFO: Adding this code coverage report to the cache for later reuse: /home/runner/work/UMVC/UMVC/UMVC.Core/./dotCover.Output.html
INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=3ms

You can see the log at: UMVC.Core SonarCloud Analysis

The tutorial what I have followed: Using dotcover and SonarCloud

  • ALM used : GitHub
  • CI system used : GitHub Actions
  • Scanner command used when applicable
dotnet sonarscanner begin /k:"UMVC.Editor" \
  /o:"loic-lopez" \
  /n:"UMVC.Editor" \
  /v:"${{ steps.gitversion.outputs.semVer }}" \
  /d:sonar.login="${{ secrets.SONAR_TOKEN_EDITOR }}" \
  /d:sonar.cs.dotcover.reportsPaths=dotCover.Output.html \
  /d:sonar.scm.provider=git \
  /d:sonar.projectDescription="UMVC - Model-View-Controller Generator built for Unity" \
  /d:sonar.host.url=https://sonarcloud.io
  • Languages of the repository: C#
  • SonarCloud project: SonarCloud
  • Error observed: No error, dotCover.Output.html uploaded but no code coverage is displayed on the project report

Hello

We have a guide for trouble shooting code coverage import - did you read it?

Hi @Andrei_Epure I have read the trouble shooting guide but is not working the file dotCover.Output.html seems to be uploaded but no coverage is displayed on SonarCloud

I have also tried to use dotnet-coverage instead of DotCover from jetbrains but it has no effect

Hi @loic-lopez,

Thanks for your feedback!

Unfortunately the build logs are no longer present. Would it be possible to do another run with verbose logging enabled (/d:“sonar.verbose=true”) and send us the logs? Additionally, could you please share with us the generated coverage file?

Best,
Costin

Hi @costin.zaharia, thanks for your reply,

See the pipeline log here : Update unity to 2021.3.16f1 & fix coverage · loic-lopez/UMVC@980ecc7 · GitHub

There is something strange in the logs :

More about the report processing at https://sonarcloud.io/api/ce/task?id=AYX0nGmxJjozFjgcJLC3

if you click on this link it says {"errors":[{"msg":"Project doesn\u0027t exist"}]} but UMVC.Core project exists in SonarCloud : https://sonarcloud.io/dashboard?id=UMVC.Core&pullRequest=61

Hi @loic-lopez,

I’m sorry for my delayed response.

I’ve checked the logs and, from what I can tell, either the generated coverage file coverage.xml does not contain the needed information.

Begin step configuration:

2023-01-27T19:01:53.9985105Z e[36;1m  /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml \e[0m

Extract from the end step:

2023-01-27T19:02:48.4121927Z 19:02:48.412 INFO: Sensor C# Tests Coverage Report Import [csharp]
2023-01-27T19:02:48.4129889Z 19:02:48.412 DEBUG: Analyzing coverage with wildcardPatternFileProvider with base dir '/home/runner/work/UMVC/UMVC/UMVC.Core/.' and file separator '/'.
2023-01-27T19:02:48.4140347Z 19:02:48.413 DEBUG: Pattern matcher extracted prefix/absolute path '/home/runner/work/UMVC/UMVC/UMVC.Core/./coverage.xml' from the given pattern 'coverage.xml'.
2023-01-27T19:02:48.4148696Z 19:02:48.414 DEBUG: Pattern matcher returns a single file: '/home/runner/work/UMVC/UMVC/UMVC.Core/./coverage.xml'.
2023-01-27T19:02:48.4153506Z 19:02:48.415 DEBUG: The current user dir is '/home/runner/work/UMVC/UMVC/UMVC.Core'.
2023-01-27T19:02:48.4162876Z 19:02:48.415 INFO: Parsing the Visual Studio coverage XML report /home/runner/work/UMVC/UMVC/UMVC.Core/./coverage.xml
2023-01-27T19:02:48.4522112Z 19:02:48.451 INFO: Adding this code coverage report to the cache for later reuse: /home/runner/work/UMVC/UMVC/UMVC.Core/./coverage.xml
2023-01-27T19:02:48.4527166Z 19:02:48.452 DEBUG: Analyzing coverage after aggregate found '0' coverage files.
2023-01-27T19:02:48.4531117Z 19:02:48.452 DEBUG: The total number of file count statistics is '0'.
2023-01-27T19:02:48.4535197Z 19:02:48.453 INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=41ms

Would it be possible to share the content of this file with us? you can upload it as a build artifact, or modify the build to it’s content during the job

Thanks,
Costin

Hi Again, sorry for the delay you can find at the address bellow this message the coverage.xml file given by dotnet test runner:

https://github.com/loic-lopez/UMVC/suites/13030419276/artifacts/706037512

Thanks for sharing the file with us. I’ve taken a look and it doesn’t contain any relevant information. There is just a list of skipped modules. This problem does not seem related to Sonar products.

Could you please check the coverage tool configuration and also how it is called?

Thanks for your reply,

The pipeline is: Update unity to 2021.3.16f1 & fix coverage by loic-lopez · Pull Request #61 · loic-lopez/UMVC · GitHub

And I use this live to generate coverage:

dotnet-coverage collect 'dotnet test' -f xml  -o 'coverage.xml'

which is enclosed by:

dotnet sonarscanner begin

and

dotnet sonarscanner end

OK. What happens if you run the same command for code coverage without enclosing it by the scanner begin and end steps? If it’s still containing only the list of skipped modules the problem is not in the scanner.

Thanks for reply and sorry for wasting your time, the issue was the tests are run in a ubuntu-latest runner on github so I switched to windows-latest and now the coverage file has no more skipped modules.

I don’t know why skipped modules are only generated on ubuntu.

1 Like

No worries. Thanks for your reply. The problem was not the presence of the skipped modules, was the lack of relevant information about the covered code.

It’s interesting that dotnet-coverage collect works, for your solution, on windows but not on ubuntu.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.