开发者

.NET WinForms startup crash

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 except开发者_运维问答ion handler around the InitializeComponents but it doesn't catch anything.

Any advise how to approach these crashes?


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.


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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜