Open rainman-63 opened 1 month ago
@rainman-63 thanks for reporting this. ReportGenerator works good with /_/
we are using it in our pipelines. You can maybe try to upgrade ReportGenerator in your pipeline and/or provide argument -sourcedirs
.
You can also try to use: <Configuration><DeterministicReport>False</DeterministicReport></Configuration>
in your configuration to try to resolve those paths. I think you need to upgrade Microsoft.CodeCoverage
package to latest in your project to take effect.
@fhnaseer could you please add DeterministicReport
option to our public documentation?
I see the same issue with my bat file here: https://github.com/jbe2277/waf/blob/34629b5f4a9d83d320050fa0b8b4da0528b07fd5/build/BuildRelease.bat
Output of reportgenerator
:
reportgenerator -reports:../out/CodeCoverageReport/System.Waf.cobertura.xml -targetdir:../out/CodeCoverageReport -reporttypes:"MarkdownSummaryGithub"
2024-11-06T21:42:42: Arguments
2024-11-06T21:42:42: -reports:../out/CodeCoverageReport/System.Waf.cobertura.xml
2024-11-06T21:42:42: -targetdir:../out/CodeCoverageReport
2024-11-06T21:42:42: -reporttypes:MarkdownSummaryGithub
2024-11-06T21:42:42: File '/_/src/System.Waf/Samples/BookLibrary/BookLibrary.Library.Presentation/App.xaml.cs' does not exist (any more).
2024-11-06T21:42:42: File '/_/src/System.Waf/Samples/BookLibrary/BookLibrary.Library.Presentation/Converters/LanguageToStringConverter.cs' does not exist (any more).
2024-11-06T21:42:42: File '/_/src/System.Waf/Samples/BookLibrary/BookLibrary.Library.Presentation/Converters/StringToUriConverter.cs' does not exist (any more).
...
I'm using the latest version of dotnet-coverage
and reportgenerator
.
When using MS CodeCoverage with SourceLink (Microsoft.SourceLink.GitHub in this case), and setting the ContinuousIntegrationBuild element in the csproj to true, the output reports will have the file path removed from the filename attributes.
Using SourceLink will cause the PDB to be altered, adding the CustomDebugAttribute and removing part of the file paths to be replaced with
/_
, which will result in the following code coverage report:Tooling like ReportGenerator use the filename to access the file to build the code coverage report, but no such file path exists on the local machine for
/_/src/NoCodeCoverage/MyMath.cs
.Other tooling like coverlet do not seem to have the same issue when using SourceLink.
I've attached a sample application that will exhibit the issue, it just needs to be setup with a git repo. NoCodeCoverage.zip
Thanks,
Raymond