I have a simple one-project-one-test-project solution. The test project pulls in a dependency with a strong name. The test project seems to compile OK, except that the tests that use the dependency all fail when the referenced assembly is resolved:
System.IO.FileLoadException : Could not load file or assembly 'Microsoft.Skype.ServiceShared.Utilities.OptionAssert, Version=1.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
----> System.IO.FileLoadException : Could not load file or assembly 'Microsoft.Skype.ServiceShared.Utilities.OptionAssert, Version=1.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
----> System.Security.SecurityException : Strong name validation failed. (Exception from HRESULT: 0x8013141A)
sn.exe says that the referenced dependency has a valid name. The tests all run just fine through nunit3-console.exe on the command line. I've switched on NCrunch's logging, at Diagnostic level, but can't see anything particularly enlightening.
The project doesn't do anything fancy - there's no rewriting, or IL emitting, or anything like that.
What else can I try to debug the issue?
Remco NCrunch Developer
#9683
12 Jan 2017 07:05 UTC
Hi, thanks for sharing this issue.
Can you describe how the reference to this particular assembly is declared? If it's an AssemblyReference inside the project XML, NCrunch should just copy the reference into its workspace without any kind of manipulation.
Something you can try is to see if you can get the project to build inside the generated structure of NCrunch's workspace. Right click on your test project in the Tests Window, then choose Advanced->Browse to workspace. This will give you a directory containing a .csproj file generated by NCrunch and NCrunch normally feeds into MSBuild. Try running MSBuild.exe against this csproj to see what result you get.
Can you describe how the reference to this particular assembly is declared? If it's an AssemblyReference inside the project XML, NCrunch should just copy the reference into its workspace without any kind of manipulation.
Something you can try is to see if you can get the project to build inside the generated structure of NCrunch's workspace. Right click on your test project in the Tests Window, then choose Advanced->Browse to workspace. This will give you a directory containing a .csproj file generated by NCrunch and NCrunch normally feeds into MSBuild. Try running MSBuild.exe against this csproj to see what result you get.
It's a Nuget 3 style reference - once of those "virtual" references that show up blue - that only appears in nuget's project.json. (It's worth noting that all our other strong named dependencies - NUnit, Newtonsoft.Json - are referenced like this, and can run fine.
The test project actually builds - all the other tests in the test assembly run (and pass). It's only the tests that call methods in this new dependency that fail.
But I don't think it's NCrunch's problem. A colleague reproduced the SecurityException outside of NCrunch.
Please feel free to declare this issue resolved, and thanks for the quick response!
The test project actually builds - all the other tests in the test assembly run (and pass). It's only the tests that call methods in this new dependency that fail.
But I don't think it's NCrunch's problem. A colleague reproduced the SecurityException outside of NCrunch.
Please feel free to declare this issue resolved, and thanks for the quick response!
OK, it was definitely our fault: we had delay-signed the dependency, but not actually signed it!
Post a reply
Log in to reply.