views:

111

answers:

2

Looks like that on some clients our WinForms up crashes on startup. With some I mean very very rare. In one situation we found out that the Arial systemfont was corrupt and caused the crashed in the InitializeComponents on startup. Finding that our was very hard, the only clue was an event log entry that the System.Drawing module caused the crash.

Now I have again such a situation but this time the faulting module is "unknown" and I am wondering how people are handling/debugging such crashes. I tried to wrap an exception handler around the InitializeComponents but it doesn't catch anything.

Any advise how to approach these crashes?

+1  A: 

You always catch the exception at main() and paste the exception to your error log. Only then you can debug and know for you.

For error logging tool, you can try log4net, or just write to a simple flat file.

Ngu Soon Hui
A: 

I've used the approach detailed at http://www.wintellect.com/CS/blogs/jclark/archive/2005/03/30/simple-main.aspx with good success.

(You'll have to ignore about 3000 lines of comment spam, though.)

Dewayne Christensen