A little back-story: When testing an installer for our C# (.NET 4.0) software recently, we installed on 7 or 8 different machines with success. But, one of our QA members installed and was able to get the application to consistently crash on his machine.
The first thing our application does - before anything else - is to spawn an external application, wait for it to do its thing, (more on this later) then exit. If we didn't launch the external application, it would prevent the crash on his machine.
The truly odd thing is that the crash happens much later in the main application. Long after the external exe had finished and exited. To verify that it wasn't the external process itself, I had the main app launch notepad instead. When he exited notepad, the application would resume as usual. This ALSO caused the crash. In the end, telling the external application to start up with "Process.UseShellExecute = false" prevented the crash.
//Successful code
Process myProcess = new Process();
myProcess.StartInfo.FileName = "MyProcess.exe";
myProcess.StartInfo.UseShellExecute = false;//Only difference between crashing and non-crashing code
myProcess.Start();
myProcess.WaitForExit();
...
myProcess.Dispose();
myProcess = null;
Other relevant info: The crash always happened on an attempted method call in an imported DLL written in Delphi 5 ages ago. Unfortunately, I don't know much about the inner-workings of this DLL, but the fact that this has only failed on this specific machine makes me think that it's not the issue. The error we got from event viewer was this:
Faulting module name: ntdll.dll, version: 6.1.7601.22436, time stamp: 0x521eaa80 Exception code: 0xc0000374
(0xc0000374 is a heap corruption)
It makes sense to me that the two types of execution would be different, but what could be different about this person's machine that using the Windows Shell would cause a crash?