Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Australia
Asked — Edited

System.Badimageformatexception Error Under VS2010

Hello,

Under VS2010 on a Win7 64pro box I am getting an error when I try to compile the examples. I am using the C# examples and adding the reference to EZ_B.DLL but when I go to run the example I get an "System.BadImageFormatException was unhandled" error and the application will not run.

I have tried changing the .NET frame work version from "4.0" to "3.5" and "2.0" without any effect. I have also tried changing the platform from "any CPU" to "x86" also with no effect.

What else could I try?

Full error below
System.BadImageFormatException was unhandled
Message=Could not load file or assembly 'EZ_B, Version=2011.6.28.0, Culture=neutral, PublicKeyToken=839146fd54f35ea1' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=Tutorial 12 - Speech Recognition
FileName=EZ_B, Version=2011.6.28.0, Culture=neutral, PublicKeyToken=839146fd54f35ea1
FusionLog==== Pre-bind state information ===
LOG: User = localhostGR0B
LOG: DisplayName = EZ_B, Version=2011.6.28.0, Culture=neutral, PublicKeyToken=839146fd54f35ea1
(Fully-specified)
LOG: Appbase = file:///C:/Users/GR0B/Downloads/Code/EZ-B SDK Windows/EZ-B SDK Windows v2011.06.28.00/C#/Tutorial 12 - Speech Recognition/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Tutorial 12 - Speech Recognition, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:UsersGR0BDownloadsCodeEZ-B SDK WindowsEZ-B SDK Windows v2011.06.28.00C#Tutorial 12 - Speech RecognitionbinDebugTutorial 12 - Speech Recognition.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFramework64v4.0.30319configmachine.config.
LOG: Post-policy reference: EZ_B, Version=2011.6.28.0, Culture=neutral, PublicKeyToken=839146fd54f35ea1
LOG: Attempting download of new URL file:///C:/Users/GR0B/Downloads/Code/EZ-B SDK Windows/EZ-B SDK Windows v2011.06.28.00/C#/Tutorial 12 - Speech Recognition/bin/Debug/EZ_B.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

StackTrace:
at Tutorial_12___Speech_Recognition.Form1..ctor()
at Tutorial_12___Speech_Recognition.Program.Main() in C:UsersGR0BDownloadsCodeEZ-B SDK WindowsEZ-B SDK Windows v2011.06.28.00C#Tutorial 12 - Speech RecognitionProgram.cs:line 15
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

AI Support Bot
Related Content
Synthiam
PRO
Synthiam
#1  
Interesting! I haven't seen that before. Let me take a quick look and see if I can replicate it
Australia
#2  
Bump.

Were you able to replicate the issue?

I have been able to replicate this issue on VS2010 express and on a second box using VS2010Pro. Both box's running Win7x64.

Has anyone compiled under VS2010 on Win7x64 ?

[GR0B]
PRO
Synthiam
#3  
Sadly I haven't been able to replicate this. I don't know what's causing it for you. Have you followed the directions on the readme.txt about what other libraries need to be installed?
#4  
Hi,
I have the same problem on Windows 7 64 bit edition. I tired the same code on my Windows 7 32 bit edition machine and it get farther. Now I get the "LoaderLock" error. I have been looking all over the forum for the solution but so far I have not found anything. I'll let you know if I find anything.
Nelson

Update: Found the loader lock information in the SDK Readme. It works on Windows 7 32 bit edition but not 64 bit edition. The 64 bit edition is having problems with the EZ-B.DLL.

Update 2: Found the workaround... Open the project and change the Platform Target to x86. Also change your build configuration to use x86. You will probably also encounter the loader loack issue. If you do go to the "Debug"/"Expceptions" enlarge the "Managed Debugging Assistants" and uncheck the "LoaderLock" box.
#5  
I've run into this too, and the workaround isn't working for me (win7 64 bit, running VS2010 SP1). Kinda sucks, I had my eye on a nice bot to modernize:(

Any big reason why it's not possible to just include an amd64 version of EZ_B.dll in the SDK? I don't think you need to be running 64 bit windows to build a 64 bit dll...

Edit: Oh, I figured it out! I need to set the type to x86 in the configuration manager (Build menu -> Configuration Manager... -> Active Solution Platform). Now I also get the OS Loader Lock error, but the readme has the solution for that.
PRO
Synthiam
#6  
@faybs good to hear you got it working. In step 7 of the read me it states

Quote:


7) Projects must be compiled as x86 (not 64 bit). Configure your project to generate x86 (32 bit) binaries.
Right click on project, select Build and change the CPU to x86


x86 is faster than x64 for the type of processing and datatypes that I use. There is no benefit to releasing a x64 DLL, it would be slower.:)