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):
ApplicationBase
— works fineApplicationBase
— works fineApplicationBase
— doesn't work, see belowApplicationBase
— works fineThe 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?
User contributions licensed under CC BY-SA 3.0