Prash's Blog

BadImageFormatException : An attempt was made to load a program with an incorrect format. September 28, 2012

Filed under: Uncategorized — prazjain @ 9:00 am
Tags:

System.InvalidOperationException : Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

System.BadImageFormatException : An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

This is the error I got when running nunit tests in my 64 bit Windows 7 machine.
I had 64 bit VS 2010, 64 bit Oracle installed.

I had nunit plugin for Visual studio, and I could right click on a test project and select “Test with NUnit”, but this was always loading up nunit-86 which is 32 bit version of nunit.
This meant it was loading up 32 Oracle client lib.

So I added nunit/bin dir to my path and loading nunit.exe from bin/debug of the test project dir and ran the dll in 64 bit nunit exe and lo and behold my tests pass!

Advertisements
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s