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 #131
Comments
Same issue open in Report generator repo here danielpalme/ReportGenerator#457 |
Any .net coverage tool relies on the debug information that is present in the .pdb file to tie the compiled IL to the original source. In the case of source generators -- having just now built and played with the official sample solution -- it seems that the compilation process invents file names under a notional folder There's no easy labelling on the code that results -- no There are also some interesting bits in the debug metadata that will bear further investigation -- embedded source blocks, which may actually represent the generated code, for example. Such things would make sense combined with the rest of the debug information as enabling step-into debugging, after all, and might be of use for reporting purposes. |
You forgot to obfuscate your file names here That would help ReportGenerator turn the current coverage information into a proper listing with red/green coverage indication -- that program would need to know per assembly the relative path from The same issues would also apply to the AltCover Visualizer, of course. That would be the opposite tack to simply suppressing the non-existent auto-generated code from coverage. I think this might keep me busy through the .net 6 release and resultant tooling upgrades I'd been planning to absorb. |
I reconsidered my security needs. And was not that important to take me the time needed to hide it 😛 For nown I will patch myself the opencover file to use the generated file in obj as suggested in ReportGenerator issue. If you find a way handle this case directly in altcover, I'll be happy to test it. |
To stay sync with ReportGenerator issue, we got a workaround : Only a chunk of the path was missing in the opencover file and luckily it 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 I hope it could help other people. |
Post-processing the output like this in a build process that knows the context is much simpler than trying to infer whether and what substitution to make in a general purpose coverage tool. It's a pity that the compiled-in path read from the There's actually a Roslyn issue here, if you want to go about addressing the root cause. |
New release v8.2.825 addresses one immediate issue related to source generators -- the |
What I am implementing now is this
Currently this is in proof-of-concept state for (extended-)OpenCover format only. |
This is now feature complete and will be in the next release of AltCover. |
Released as v8.2.828. |
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.
The text was updated successfully, but these errors were encountered: