Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Can't load strong named dependency
FrankShearar
#1 Posted : Thursday, January 12, 2017 6:56:11 AM(UTC)
Rank: Member

Groups: Registered
Joined: 1/20/2015(UTC)
Posts: 17
Location: United Kingdom

Was thanked: 2 time(s) in 2 post(s)
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
#2 Posted : Thursday, January 12, 2017 7:05:43 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,974

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
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.
FrankShearar
#3 Posted : Thursday, January 12, 2017 7:12:52 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/20/2015(UTC)
Posts: 17
Location: United Kingdom

Was thanked: 2 time(s) in 2 post(s)
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!
FrankShearar
#4 Posted : Thursday, January 12, 2017 9:25:33 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/20/2015(UTC)
Posts: 17
Location: United Kingdom

Was thanked: 2 time(s) in 2 post(s)
OK, it was definitely our fault: we had delay-signed the dependency, but not actually signed it!
1 user thanked FrankShearar for this useful post.
Remco on 1/12/2017(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.029 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download