.NET WinForms 启动崩溃
看起来在某些客户端上我们的 WinForms up 在启动时崩溃了。对于某些我的意思是非常非常罕见。在一种情况下,我们发现 Arial 系统字体已损坏并导致启动时 InitializeComponents 崩溃。发现我们的工作非常困难,唯一的线索是 System.Drawing 模块导致崩溃的事件日志条目。
现在我再次遇到这种情况,但这次故障模块是“未知”,我想知道人们如何处理/调试此类崩溃。我尝试在 InitializeComponents 周围包装一个异常处理程序,但它没有捕获任何内容。
有什么建议如何处理这些崩溃吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您始终在
main()
处捕获异常并将异常粘贴到错误日志中。只有这样你才能调试并为你了解。对于错误记录工具,您可以尝试 log4net,或者只写入一个简单的平面文件。
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.
我使用了 中详细介绍的方法http://www.wintellect.com/CS/blogs/jclark/archive/2005/03/30/simple-main.aspx 取得了巨大成功。
(不过,您必须忽略大约 3000 行垃圾评论。)
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.)