HelloCodeModel sample error

Dec 9, 2010 at 8:18 AM

Hi

I have compiled the HelloCodeModel sample from the downloaded svn sources and it does create the hello.exe file, but the hello.exe file does throw the following exception when executed fro the command line.

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'hello.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'hello.exe'

The HelloIL sample (same program  really) runs ok.

When comparing both exe files, using Reflector, it seems that the "broken" one is missing a __Globals__ class as well as a .ctor() statement within the Test class definifion .

Coordinator
Jan 10, 2011 at 5:32 PM

The sample has now been updated and should work again. The underlying problem was a change in the default behavior of the PE writer. There is now a flag to control if a runtime startup stub is emitted. By default, the flag is false. Unfortunately, 32-bit systems require the startup stub to be present (even though the stub is not actually used).