-
Notifications
You must be signed in to change notification settings - Fork 386
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
Tests fail if assembly is strong named #347
Comments
Looks like this is caused by xUnit's app domains. For |
@tonerdo maybe we should document? |
The workaround I've used is to drop this app.config file into the test directory, which prevents xunit shadow copying. If coverlet fundamentally has to change the assembly being instrumented, I don't see an alternative. But I wonder why this is necessary, as I think other coverage tools don't require this. Do they hook into the CLR's profiler APIs to rewrite IL on-the-fly instead of rewriting the assembly? |
@AArnott that config file works for .NET Framework based tests, but I don't believe it is used for the .NET Core-based ones. The RunSettings/ command-line parameter I mention above does work though. |
That doesn't matter. This failure doesn't occur in .NET Core anyway because .NET Core never validates signatures on strong name assemblies. So a .NET Framework-only workaround is all that's required. |
Uh...I'm curious to know how do they do without touch asm, if you've more detail or some docs share please. |
Here's one introductory link : http://blog.monstuff.com/archives/000058.html |
I'm hitting this again, and the workaround doesn't apply, because the test method itself explicitly creates an appdomain and uses shadow copying in order to test that the assembly behaves properly in those conditions. |
Thank's for reporting this Andrew, strongname is applied on your assembly?Do you have the key? |
Yes, we fully strong name sign as part of the build, so if your instrumenting step could refresh the signature that would work. |
Thank's for your opinion, it's very appreciated really. |
This commit removes coverlet.msbuild from windows CI. Coverage on Windows is collected with coverlet.collector. * Build in Release * Don't let xunit use AppDomains See coverlet-coverage/coverlet#347 * disable test parallelization * Don't add coverlet.collector for net461 * Remove tests for netcoreapp2.2 * Update JunitXml.TestLogger and coverlet.collector
…ified. [xUnit.net 00:00:01.77] Skipping: SDL2Sharp.Interop.UnitTests (could not load dependent assembly 'SDL2Sharp.Interop.UnitTests, Version=0.2.1'): Could not load file or assembly 'SDL2Sharp.Interop.UnitTests, Version=0.2.1.0, Culture=neutral, PublicKeyToken=87d82c2fc2ab882f' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045) See: coverlet-coverage/coverlet#347
… be verified. [xUnit.net 00:00:01.77] Skipping: SDL2Sharp.Interop.UnitTests (could not load dependent assembly 'SDL2Sharp.Interop.UnitTests, Version=0.2.1'): Could not load file or assembly 'SDL2Sharp.Interop.UnitTests, Version=0.2.1.0, Culture=neutral, PublicKeyToken=87d82c2fc2ab882f' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045) See: coverlet-coverage/coverlet#347
I'm trying to use Coverlet against an assembly that is strong named. When running those tests on the .NET 4.6.1 target, I get many errors similar to this:
Is there a way to make this work?
The text was updated successfully, but these errors were encountered: