0% Coverage for Blazor apps tested with bUnit
Hello,
I am using Coverlet to generate coverage for one of my libraries and I see that my RCL (Microsoft.NET.Sdk.Razor) doesn't seem to contain any coverage. I know Blazor uses a Source Generator to generate things like the BuildRenderTree, but are they picked up by Coverlet?
The problem is that coverlet uses heuristic to decide what to instrument and we check if dll has got all source on local disk. Now with the code generators wave this heuristic is not more good.
We did a fix on main(not shipped yet) that you can dogfood and force the instrumentation of the dll also if local sources are missing InstrumentModulesWithoutLocalSources
https://github.com/coverlet-coverage/coverlet/pull/1360
It's not shipped yet but you can give it a try and check if it works as expected https://github.com/coverlet-coverage/coverlet/pull/1360#issuecomment-1199310423
I've added the documentation https://github.com/coverlet-coverage/coverlet/commit/2b8a4565b101ca70c3eaa9b5228c449dd3b81ad1
Could you try to reproduce this with the current nightly (consume nightly)? We changed something in our default heuristics which most likely solves the issue. E.g. there was a similar issue with MAUI projects that is also resolved in the current nightly (#1423 ).
This issue is stale because it has been open for 3 months with no activity.
This issue was closed because it has been inactive for 9 months since being marked as stale.