|
|
|
Clarification: We call out to 64-bit unmanaged code from our assemblies, so they must be run in the framework64. If we compile for AnyCPU, the nunit tests run and then fail with BadImageFormatException when we call out to unmanaged code. If we compile for x64 CPU, the entire unit test assembly fails to start, with the same error.
System details: Any chance you can share which system detail/variable controls which .net framework version/platform is used for running the nunit test runner? I found the culprit: In 4.0.818.11, the JetBrains.ReSharper.TaskRunner.exe assembly is compiled 32bit only. Judging by the version related differences surrounding the comments on other related issues on this issue tracker, I imagine that it hasn't always been the case. Can you point us to a compatible TaskRunner that is compiled for AnyCPU? That would help us out greatly.
I just installed 4.0.904.3 and got the same behavior. Not being able to test 64 but code on a 64 bit OS is kinda weak. --Sandy One option for this would be to use the "corflags.exe /32BIT-" on the TaskRunner.exe and all of it's dependent assemblies. This will allow the process to execute in x64. I've had pretty good success with this, but please only do this as an act of desperation. If you're resharper installation stops working, it's not my fault.
I'm experiencing the same error. It seems to have occured after I upgraded NUnit from 2.4.7 to 2.4.8. However, uninstalling it and referencing 2.4.7 again did not solve the problem. Here is the stacktrace:
System.BadImageFormatException: Attempted to load a 64-bit assembly on a 32-bit platform. Use ReflectionOnlyLoad() instead if trying to load for reflection purposes. I tried the corflags fix (closed all relevant processes etc) but it still wont work:
C:\Program Files (x86)\JetBrains\ReSharper\v4.1\Bin>copy JetBrains.ReSharper.TaskRunner.exe taskrunner.bak 1 file(s) copied. C:\Program Files (x86)\JetBrains\ReSharper\v4.1\Bin>copy JetBrains.ReSharper.TaskRunnerFramework.dll taskrunnerframework.bak C:\Program Files (x86)\JetBrains\ReSharper\v4.1\Bin>corflags JetBrains.ReSharper.TaskRunner.exe /32BIT- corflags : error CF001 : Could not open file for writing C:\Program Files (x86)\JetBrains\ReSharper\v4.1\Bin>corflags JetBrains.ReSharper.TaskRunner.exe /32BIT- corflags : error CF001 : Could not open file for writing My last comment may be related to vista restrictions. I'm allowed to copy the dlls and run corflags on the copies (in the same dir), but I'm not allowed to do anything with the original files.
Tested another project which worked fine. Problem seems to be related to a referenced component "Cablib.dll" that I'm using. This component was build exclusively for 64bit. by using a 32bit version the error disappeared.
Just adding another "Me too". In my case it's Oracle (11g) - the Oracle.DataAccess dll has 32 bit and 64 bit versions. The application is built for "Any CPU" and linked to the 64 bit dll.
Running unit tests inside Resharper fails because the test runner can't load the x64 assembly, it wants the x86 version. Linking the x86 version leads to a whole other stack of problems with mixing 32 and 64 bit oracle clients so that's not a viable workaround - the end result is that I can't run / debug any database tests inside Resharper. I just retested this using resharper 5.0 build 1519 and Im still getting this error . This is the error Im getting:
System.BadImageFormatException : An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) This is when its trying to it an interop . Everything is all 64bit since we only support 64 in our application. Its says its fixed in version 5 but it still seems to be there . Im not sure but if they could look at how it was working in resharper 3.1 since thats the last version that worked in 64 bit mode. Our whole development teem is stuck running with resharper 3.1 because if this so I was really hoping it was fixed in version 5 . Note that we also use oracle and we get the same error related to OracleDataAccess.dll(64 bit dll) in resharper 5 . It looks like the resharper unit tester doesnt support anything related to 64 bit. thanks scott I just retested this in our environment and Im still getting the bad format error:
System.BadImageFormatException : An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) I checked the resharper about and verified I was running build 1536.55 . We are also using oracle now too so we are getting this error using the oracle driver since its also 64bit. Is there anything else I should be doing to get this working. thanks scott Need to investigate these problems.
In our test environment everything is working well. Unit Test Runner now works correctly when using native dlls.
I just retests this in build 1539.18 and Im still getting this error doing an interop call to a 64bit dll:
System.BadImageFormatException : An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Please, check your project settings, is it compiled for "Any CPU" or "x64"?
We have about 100 projects in our solution and they are all set to Any CPU , should that make a difference?
Just to let you know, I tried changing it from AnyCPU to x64 and it worked. Since AnyCPU is valid , if you are picking on this
couldnt you check the operating system type if its AnyCPU since it will jit compile to 32 or 64 based on this if its set to AnyCPU anyhow. There are some fixes related to this problem in build 1753.
I just tried the most recent build 1573 and it all works ok now, even with it set to AnyCPU .
thanks scott |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
--Sandy