-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deterministic Source Paths Breaks Coverage - VS Coverage format #3362
Comments
Hi @iamwyza I tried to come up with a reproducer and created as you said a project referencing Microsoft.SourceLink.GitHub - https://github.com/andrei-epure-sonarsource/TestSourceLink . And it seems code coverage works fine https://sonarcloud.io/dashboard?id=DeterministicSourcePath .
The commands I've used:
What code coverage tool have you used? |
I'm using dotnet test, so it'd be the built-in one for dotnet (I think that's just vstest under the covers).
A segment of that output would look like:
|
I've added a small project on which we can reproduce this issue: https://github.com/costin-zaharia-sonarsource/Repro3362 Steps: https://github.com/costin-zaharia-sonarsource/Repro3362#steps |
Initial investigationI followed the steps provided by @costin-zaharia-sonarsource in his reproducer. With DeterministicSourcePathsRun with in
When running in debug mode, we can see the below line (note that it's
Unfortunately, in the statistics at the end, we don't mention skipped files (the test file is correctly detected, because it has the full path in the coverage files; only main files seem to have the path mangled).
Without DeterministicSourcePathsin
and coverage works as expected With DeterministicSourcePaths and SourceRootAdded the property mentioned in this comment and built with Possible planBefore moving forward:
Action items:
I need to understand what that means, first.
|
Actually, before any action, I need to read what coverlet did to support this coverlet-coverage/coverlet#863 and dotnet/roslyn#43476. |
SourceRoot InitializeSourceRootMappedPaths - This target collects all SourceRoots from various sources. Work done on Coverlet:
Maybe not so relevant:
Other links
|
hi @iamwyza - did you have the chance to test the Scanner for MSBuild with deterministic source paths enabled for your project(s)? |
@andrei-epure-sonarsource I updated Steeltoe to use the latest package but I'm still seeing 0% coverage in SonarCloud (sample build) The SonarScanner Context says I'd be happy to provide any additional info or try things out |
Hi @TimHess , thanks a lot for the feedback. We currently support Deterministic Builds with VS Coverage reports. I updated the release notes for clarity now. I saw in your logs that you're using OpenCover reports. I've opened #3976 to close this gap. I added a note in the issue to ask you after the release that all works well. |
Hi, I am still facing this issue. See my report here: SourceLink breaks coverage report generation |
Description
If deterministic source paths are enabled during the builds, the scanner will fail to find the code coverage for the code. (The coverage reports will be indexed, but it will say 0 files matched). This happens by default with the Microsoft.SourceLink package.
Repro steps
Create a dotnet core project with 1 class and 1 unit test project, add the Microsoft.SourceLink package, and then run the sonar scanner against it. It will fail to produce code coverage.
Known workarounds
Turn deterministic source paths off.
Related information
The text was updated successfully, but these errors were encountered: