Fixing EVEMon’s Crashy C++ DLLs

April 18, 2009 – 20:22

I have been working on EVEMon for about two months now, taking on the responsibility of committing changes to the trunk, fixing bugs and adding new features. As a project I have been involved for several years submitting bug fixes and little features, it was down to my experiences with EVEMon that I decided to implement Subversion and Trac at work.

Unfortunately the first time it came to me to be responsible for a release, it seemed to go terribly wrong. The updated installer worked fine, and it seemed initially there were no problems with the updated code base. However BattleClinic shortly went a little mad with bug reports similar to this one:

EVEMon Version: 1.2.7.1283
.NET Runtime Version: 2.0.50727.1434
Operating System: Microsoft Windows NT 6.0.6001 Service Pack 1
Executable Path: “C:\Program Files\EVEMon\EVEMon.exe”

System.IO.FileLoadException: Could not load file or assembly ‘lgLCDNETWrapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)
File name: ‘lgLCDNETWrapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null’ —> System.Runtime.InteropServices.COMException (0x800736B1): The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)
at EVEMon.LogitechG15.Lcdisplay.Dispose(Boolean bDisposing)
at EVEMon.LogitechG15.Lcdisplay.Finalize() in D:\EVEMon\EveMon.LogitechG15\Lcdisplay.cs:line 70

For those who are not familiar the above is the crash report generated by EVEMon when a .NET exception is unhandled. lgLCDNETWrapper is the C++ library EVEMon uses to communicate with the Logitech G15. A similar error was generated for EVEMons other C++ component the window relocator.

Tonto Auri quickly spotted that the problem was something to do with the re-compiled C++ DLLs and switching the new DLLs with those from an older package resolved the problems. Whilst this was a fix, I wasn’t willing to just revert the changes and give up on the changes we had made to the G15 library, additionally I was concerned that we had not made changes to the window relocation code and that was causing at least one person a problem.

Quite a bit of searching about with Google and Stack Overflow resulting in finding these two little gems of information:

These two posts basically gave me the tools and the knowledge to fix EVEMon’s problems.

First I made the sudden (and “facepalm”) realization that EVEMon deployed the Visual Studio 2005 Redistributable; we had moved to Visual Studio 2008 SP1 about a month before the release of 1.2.7. I confirmed this with the Dependency Walker utility, by walking lgLCDNETWrapper.dll I was able to confirm that version 9.0.21022.8 of the Microsoft CRT Library (Microsoft.VC90.CRT) would be required.

The next trick was figuring out which re-distributables to deploy with EVEMon to ensure the end user would have all the dependencies required to use all of the features; frustratingly it seems that Microsoft only bundles the latest version of the re-distributables with Visual Studio 2008 and that was version 9.0.30729.1 which was not going to cut it.

Enter Nuonsofts excellent article providing a step by step guide on adding the required compiler flags to ensure the latest version of the CRT was bound. I did find a nice GUI resource editor that was capable of getting the manifests out in XN Resource Editor which made the process a little faster.

A little bit of hacking later the updated Visual Studio 2008 SP1 CRT DLLs and manifest file were deployed to the Microsoft.VC90.CRT folder within the EVEMon program files directory as the VC80 CRT libraries were in the past and the two C++ projects were setup to bind to the latest version with the _BIND_TO_CURRENT_CRT_VERSION=1 preprocessor definition.

A bit more poking arround with XN Resource Editor and Dependency Walker showed we were now in a far better position to have a working copy of EVEMon in the hands of our end users.

Be Sociable, Share!
    1. One Response to “Fixing EVEMon’s Crashy C++ DLLs”

    2. Ah, I remember going through all this a few months ago with our project. We still occasionally get the odd install that fails for no apparent reason, particularly on Vista.

      By Tim on May 7, 2009

    Post a Comment

    Please leave these two fields as-is: