Support deterministic paths for C# coverage

  • SonarQube Server 2026.1
  • Azure DevOps pipelines

dotnet coverage has a coverage configuration DeterministicReport(see codecoverage/docs/configuration.md at main · microsoft/codecoverage · GitHub and related sourcelink/docs/README.md at main · dotnet/sourcelink · GitHub ).

This uses filenames starting with “/_/” instead of the build root path, which is a well-known fragment of dotnet tools (`dotnet test` always collect code coverage if datacollector is defined in `.runsettings` file · Issue #10135 · microsoft/testfx · GitHub)

It would be very nice, if reading such filenames would directly be supported by SonarQube.

Hey @carlossus, it seems this is already supported. Our docs say:

DeterministicSourcePaths is supported for VS Coverage and OpenCover, but not for dotCover reports.

Perhaps something is misconfigured on your side, though. Could you have a look at your coverage report and your debug-level scanner logs to make sure the paths are aligned? Do you see any errors or warnings?

Thanks for the feedback.

Seems I got lost fighting with the pecularities of different tools (dotnet test, dotnet coverage and SonarQube) and how they finally fit together somehow (using cobertura as coverage format).

That was visible in the pipeline logs like

INFO: Imported coverage data for 5308 files
INFO: Coverage data ignored for 653 unknown files, including:
/_/Apps/Project/MyFile.cs

However, I cannot recall the complete setup which I had.

Currently I use ReportGenerator to convert the Cobertura coverage report to a generic SonarQube report and then sonar.coverageReportPaths. And this one doesn’t support deterministic paths.

So let’s hope that the cobertura path supports deterministic paths.