Loring Software, Inc

A Software Developer's Notebook

I had a late one last night trying to track down why a C++ dll wouldn't load in my WPF app when loaded on a tablet running Windows 7. The app would start up, but when it got to a chunck of code which needed the Touchless Vision library (a wonderful library, by the way), I would get a

Problem Signature 09: System.IO.FileNotFoundException

exception, and the library would not load.

Because I was on a tablet, I figured the device had been kneecapped in some why, so that sent me down a bunch of different (wrong) paths having to do with Direct Show. But the obvious thing I wanted to do was to simply name that missing DLL. My first searches pointed me to Dependency Walker. But, unfortunately, it turns out that it cannot profile on Windows 7, since the code attempts to inject its own DLL into the application to profile, and Windows 7 is (fortunately) stopping that from happening. The error I would get is

00:00:00.359: STATUS_STACK_BUFFER_OVERRUN encountered
00:00:00.375: Entrypoint reached. All implicit modules have been loaded.

So, it would die before it got anywhere near my loading of the DLL.

What I did find was the the Event View's Application Log was logging a Windows Error Reporting event with a pointer to a WER file that reported on the error:


Which has a bunch of lines such as:


Now that file is nice enough to list all the DLLs that were loaded up until the exception. But it still did not list the DLL that it could not find. But I know that the app loaded on my development machine, so all I had to do was get past the point in my program where it crashes on the Tablet, and then crash it on my dev machine, causing an event in Event Viewer. A simple

    int a = 0;
    int b = 1 / a;

was enough to get the code to crash right after my first call to the DLL. Now, when I go to the WER file on my dev machine, I get the complete list of DLLs loaded right up to and past the point where the tablet failed. Compare the two files, and viola: Since I was running the debug version of the application on the tablet, I was loading the debug version of the C++ library, which, by the way, will need the MSVC100D.dll to run. Argh, how many times has that bit me in the past 15 years. Of course, since I haven't been doing MFC for about 10 years, I had completely forgot about that.

Time to catch up on some sleep.

Copyright © 2024 Loring Software, Inc. All Rights Reserved
Questions about what I am writing about? Email me