Build/Test Issues

Strong Name Validation Failed

Started by ianw89 on 9,271 views

I'm trying to onboard some existing projects to NCrunch.

I have my product assemblies building in NCrunch fine, as does the test DLL. However, when it goes to run the tests, I hit this:

[SPOILER]

[14:31:54.361-TestExecutionTask-30] ERROR (Internal): System.IO.FileLoadException: Could not load file or assembly 'Company.Product.TDD.Tests, Version=4.0.0.0, Culture=neutral, PublicKeyToken=abcdefghijklmnop' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'Company.Product.TDD.Tests, Version=4.0.0.0, Culture=neutral, PublicKeyToken=abcdefghijklmnop' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at nCrunch.TestExecution.Frameworks.MSTest.MSTestFramework.InitialiseFrameworkForExecution(String solutionDirectory, String testAssemblyPath, Int32 defaultTimeout)
at nCrunch.TestExecution.RemoteTaskRunner.#=qZWpQ9Fw22coT4CYtVCQtBhy6_ObFkRjwoNz3BHL7LTQ=(Type #=q1APDvnYbnncAEGFyjNsjXDgNdldLD1p4qgqUZXeCdLc=)
at nCrunch.TestExecution.RemoteTaskRunner.RunTests(IMasterExecutionMap[] masterExecutionMaps, IList`1 testsToRun, Type testFrameworkType, Boolean considerInconclusiveTestsAsPassing)

[/SPOILER]

I used fuslog to try and get a better look at the issue, but it doesn't really tell me anything useful. Also, I've used sn.exe to ensure that the PublicKeyToken that was used to delay sign the assemblies is being allowed.

In my NCrunch config, I have "Prevent signing of output assembly" set to false. Should I be setting this to true and doing something special maybe, as the troubleshooting section says? I'm not really sure what to do next.
Hi -

Thanks for posting! It looks to me like you have a complex signing scenario set up within this solution, so the best way to get this working with NCrunch is definitely to set the 'Prevent signing of output assembly' to TRUE for ALL of the projects in your solution. Hopefully this will resolve your problem.


Cheers,

Remco
So, simply changing this setting to true doesn't change seem to change anything any all - I still always get the same error. I changed it on every project in the solution.
Would you be able to answer some of the questions below? This will help me to better establish why the issue is occurring:

- Is the assembly 'Company.Product.TDD.Tests' derived from a project within the same solution you are using NCrunch on?
- How is the above assembly referenced from other projects in the solution? Is this through an MSBuild <ProjectReference> or an <AssemblyReference> ?
- If this is itself an assembly containing tests, is there a reason it is signed?
- Is the assembly ever loaded into the GAC?
- Are you making use of the 'Copy referenced assemblies to workspace' setting for any of the projects in your solution?

If you can submit a bug report, this would also be very helpful as the log file may yield some clues as to what is happening.

Thanks!

Remco

Edited

Post a reply

Log in to reply.