64-bit unit testing - BadImageFormatException

Hi

I can't seem to get Resharper to run my 64-bit unit tests. The assembly is marked as X64, I'm running on 64-bit Windows 7, I've got VS2012.2 installed, as well as the new Resharper 7.1.3000 release.

I've tried in Legacy Runner (this just marks each test as "Test didn't run") and Not Legacy Runner (which gives the below stack trace).

It is clear from the stack trace that it is trying to use the vstest.executionengine.x86.exe to run the tests, but I'm not sure why. Visual Studio runs them fine.

I've ticked the "Default Processor Architecture" in the test menu (which did stop Visual Studio running the tests) and restarted Visual Studio a couple of times to no avail.
I've tried switching the target framework from 4.0 to 4.5 and that doesn't make a difference either.



Any more ideas?

Sam

Attachment(s):
unit test stack trace.txt.zip
4 comments
Comment actions Permalink

Is the unit test assembly also 64 bit? Are any of the dependencies of the test assembly, or the assembly under test explicitly 32 bit?

0
Comment actions Permalink

The unit test assembly is 64-bit, 1 other assembly is 64-bit (the one under test), all others are AnyCPU.

Sam

0
Comment actions Permalink

Hi, Sam

by default MSTest forces tests to run in 32-bit mode. To change this  behavior you need to create custom .testsettings file (Add New Item to  Solution - Test Settings), edit this file and on Hosts page select "Run  tests in 64 bit process on 64 bit machine". Then point ReSharper to use  this settings, by selecting this file on ReSharper - Options - Unit  Testing - MSTest.

After this one time setup you'll be able to run x64 tests easily.

We plan to add support for .runsettings file (and therefore Default Process Achitecture from VS menu) in next version. You can follow progress here: http://youtrack.jetbrains.com/issue/RSRP-336300

0
Comment actions Permalink

Hi

Thanks for that.

I did have one further issue - Resharper only seems to pick test settings up when they are in the "Solution Items" folder. I moved my test settings into a "Tests" solution folder where all my test projects are and it didn't appear on the Test Run Configuration drop down in the Resharper MSTest Options section.

But I'm now up and running my 64-bit tests in Resharper, so I'm happy.

Sam

0

Please sign in to leave a comment.