-
-
Notifications
You must be signed in to change notification settings - Fork 283
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
Support for Source Generator #457
Comments
ReportGenerator parses file coverage file generated by altcover, but is unable to find the file. One option might be to ignore the file with |
And what path does the altcover file contain, when you add the EmitCompilerGeneratedFiles=true option? |
Unfortunately, the path in the report file is still the same |
Then you could replace the path in the file with the correct one in the Example (you have to adjust paths and filenames): (gc "opencover.xml") | % { $_ -replace "/TODO1/HangFireJobs.Generated.cs", "/TODO2/HangFireJobs.Generated.cs" } | Out-File "opencover.xml" -Encoding UTF8 |
Ah, cool. I will try this. Thank |
It worked 🎉 Only a chunk of the path was missing and does not depend on the project the generator is installed. So this bash command for all project at once. It's still a hack but not so much. We can live with it. - sed -i "s/Marketplace.Common.Generators\//obj\/Debug\/net5.0\/generated\/Marketplace.Common.Generators\//g" *.opencover.xml Thank you the the help. I let you close this issue if you think it should. |
Great that it is working for you! |
In the next release, AltCover will include embedded source in the reports it emits, which can be used to mitigate this issue. The source is represented as UTF8 string -> bytes -> deflate compression -> Base64 encoded string. For OpenCover format, there is an Samples follow -- |
For the record, AltCover, like other coverage tools, relies on the information provided in the debug symbols for source paths. If this is an embellishment of the reality, the issue lies with the compiler that puts that information into the debug database. Fortunately the compiler does embed the source by default, which would be used for e.g. debug step-into, hence the change alluded to above. |
And the next version of ReportGenerator will support embedded source files for OpenCover. |
We're both waiting on .net 6, then. I suspect there will be a lot of similar upgrade versions dropping all week. |
After some delays e.g. Windows Defender being over-enthusiastic, feature released as part of AltCover v8.2.828 |
ReportGenerator has been updated too: |
@terryaney Your Coberatura files probably contains the file paths that (no longer) exist on disk. E.g. |
Thanks. Note, in my dotnet test, I used
|
Describe the bug
Hello,
I use altcover (global tool) to generate code coverage for an .Net5.0 app. And use the result as open cover format to generate report with Report-Generator.
The line coverage is ok. But report generator is unable to find related file. (Understandable as source generated file are in memory only by default.
I don't know if it's in altcover scope or in report generator. Or both.
And btw, thx for your great work on this tool.
To Reproduce
The text was updated successfully, but these errors were encountered: