Code Coverage incompatible with Mono.Cecil rewritten assemblies
I am using a concurrency testing library which injects stubs/hooks into assemblies as part of the testing process.
The testing library is Microsoft Coyote and it uses Mono.Cecil to perform such rewrites mostly focused on the .NET Task Threading library - example code.
The tool works well but looks to be incompatible with VS Code Coverage. If I have multiple projects that have common assemblies and perform rewrite on one of them. e.g.:
ProjectFoo - Foo.dll
ProjectA
-Foo.dll (rewritten w/ Coyote)
ProjectB
-Foo.dll (not rewritten)
Then code coverage interprets Foo.dll as two entirely separate assemblies. If I use the ‘Analyze Code Coverage’ feature, the .coverage will show:
- Foo.dll
- Foo.dll {some-guid}
One of them will have expected code-coverage, the other much lower. This plummets my overall code coverage - the same happens in BuildQualityCheck in DevOps.
I have tried brainstorming with the Coyote team on potential solutions. But I would just like to gain some clarity from people with stronger domain knowledge of code coverage - that the behavior I have observed is expected given code coverage interpretation logic, and what possible solutions Coyote could implement to circumvent this issue.