Why doesn't Strong Name Bypass work under AppDoman.ApplicationBase when using xUnit?

1

I have tampered with a public key on an assembly using Mono.Cecil (for a reason). The signature of the assembly is now invalid, but I expect it to work anyways due to Strong Name Bypass. Now I try to load it (.NET 4.7.1):

  1. Console app, folder under ApplicationBase — works fine
  2. Console app, folder not under ApplicationBase — works fine
  3. xUnit test, folder under ApplicationBase — doesn't work, see below
  4. xUnit test, folder not under ApplicationBase — works fine

The error I get in 3 is: Could not load file or assembly 'MyAssembly, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 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)

I don't understand 2 (according to Strong Name Bypass article it shouldn't work), and I don't understand 4 for the same reason, but my main question is about 3.

Why wouldn't Strong Name Bypass apply in case 3, if it works in all other cases?

Update:

If I disable shadow copy in xUnit, scenario 3 starts to work -- why?

.net
strongname
asked on Stack Overflow Sep 5, 2018 by Andrey Shchekin • edited Sep 6, 2018 by Andrey Shchekin

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0