On Software: Check for errors and don’t fail (too) silently


While I was running the old-but-still-officially-current version 1.1.0 of RandFill recently (to analyze a change between that version and the 1.2.x branch), I stumbled upon a strange behaviour:

  • Running it on a freshly installed Windows XP (32-bit) system and also on a freshly installed Windows 7 (64-bit), everything was OK.
  • Starting it on a different Windows 7 (64-bit) system, this resulted in an APPCRASH (according to the Eventlog) before showing any GUI or error messages.

Huh? *blink* Both Win7 machines were installed with the same basic set of software (via a software deployment tool), except that on the problematic system also Visual Studio & Co. were installed.

I suspected a problem with the runtime libraries or a similar file version conflict. On the other hand, application crashes caused by that come normally with an error message of some kind provided by the operating system; they usually don’t fail silently. Just for the sake of it, I did reinstall the Visual C++ Redistributable Packages; but as expected to no avail.

Then, through some searching on the web, I was reminded of the existence of the Dependency Walker (depends.exe), which I even had installed already on the machine.

Opening the affected executable with that tool and running “Profile → Start Profiling…”, the log showed an Access violation error at the end. Being a rather simple tool, there’s not so much happening behind the curtains at startup — except… reading the configuration from %APPDATA%\RandFill\settings.ini.

The security/access rights on the folder and file were identical in both cases.

As it turned out, RandFill 1.1.0 didn’t like it that one value was missing from the file (which was created by the newer 1.2.x version a while back, which currently doesn’t need that data. Also, the 1.2.x branch reads and writes the settings differently and won’t commit suicide when a value is missing or if it finds an unknown entry in it).

So, lessons learned:

  • Be more generous with error checking/handling and information on failures in your program (pop-up windows, logfiles, …).
  • Remember the Dependency Walker.

Leave a comment

Your email address will not be published.