Sunday, March 13, 2011

No more BadImageFormatExceptions


As far as I can tell, one of the most common errors that users encounter with DILE is that it crashes on startup with a default Windows error message box. Usually an entry is generated in the Event Log though that says an unhandled BadImageFormatException caused the problem.

Most often the reason for this error is that the Microsoft Visual C++ Runtime is not installed on the machine and therefore the Dile.Debug.dll (which is a VC++ assembly) cannot be loaded. Obviously, installing the runtime solves this problem.

However, there's one more solution: copying the necessary runtime files in the folder of the application. This way installation of the runtime can be avoided.

So, to avoid such ugly BadImageFormatExceptions in the future, I'll include the necessary files (mvcp100.dll and msvcr100.dll) in all new releases of DILE. This means each release will be ~0.5 MB bigger but hopefully this step will save a lot of headache for new users. And DILE will still fit on a 3.5" floppy disk. :-)

Of course, if you don't want to have those extra dlls in the DILE folder then you can delete them and rather install the VC++ runtime.