Resharper 6.1 - Unit Test Runner failed to load test assembly

I was pretty excited to update my Resharper 6.0 to 6.1. I downloaded the new version as soon as I could.

Unfortunately, a little nasty regression was introduced with the unit test runner which ships with Resharper.


I got the following error message whenever I attempted to execute any tests in my unit test project.

Unit Test Runner failed to load test assembly

System.BadImageFormatException: Could not load file or assembly 'AiChallenge, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

[Expanded Information]
   at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at NUnit.Core.CoreExtensions.InstallAdhocExtensions(Assembly assembly)
   at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
   at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
   at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
   at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
   at JetBrains.ReSharper.UnitTestRunner .nUnit.NUnitTaskRunner.ExecuteRecursive(TaskExecutionNode node)

To fix the error, simple change your unit test assembly to target the x86 platform.

To find that configration option, follow the following steps:

  1. Right click on project.
  2. Click on “Properties”.
  3. Click on the “Build” tab on the right.
  4. There is a drop down labelled “Platform target.”
  5. Change that to “x86 only.”

This would mean that all your code would run in the x86 manner, which should not be a problem in most solutions. Unless you are one of those unfortunates who need to talk to libraries only compiled for the 64-bit architecture… then I suppose you will need something else to float your x64 ship, sorry :(

blog comments powered by Disqus