In addition to the previous response:
What message is in the event log?
Do you have access to the system where it happens, or does it happen
only on a customer system far from your site?
Remove these handlers to make the problem more reproducible,
otherwise they (exception handlers) can hide the problem if they catch too much.
Use only C++ catch statements if needed, and do not use catch(...).
Better rely on out-of-process tools like Dr. Watson to get the log and crash dump.
Also make sure that you do not call SetErrorMode(SEM_NOGPFAULTERRORBOX)
function, since it disables JIT debugging.
Try the following:
* Download Debugging Tools for Windows, install it and in its documentation
read "Crash Dumps" chapter - it will give lots of useful information.
* On the system where the problem happens, register Dr. Watson as the JIT de ***
and configure it to produce log file and crash dump.
* Monitor the application with PerfMon to see if there are memory/resource leaks
(many such cases can be explained by leaks). Use counters under Process and Memory
* If the problem happens on your system, try to reproduce it under de *** .
When doing it, enable all available operating system checks (PageHeap,
AppVerifier (only since WinXP; use PageHeap, lock and handle verification).
Also set breakpoint on NtTerminateProcess in NTDLL.DLL, so that you will
always get control when the application is terminating, and will be able to check
the call stack and see exactly why it is terminating.
How to enable PageHeap:
If you have Debugging Tools for Windows, use "gflags -p /enable YourApp.exe /full"
to enable Full PageHeap.
Here you can find more information about it:
On Windows XP/2003 with AppVerifier installed, simply check PageHeap,
Locks and Handles for the application.
Consider also using tracing, it can tell you what exactly is going inside the application.