[英].NET Runtime Error causes process to crash! But there's no unhandled exception - Why? CLR bug?
I have a .Net process which runs 24/7 which crashes once or twice per week. 我有一个全天候运行的.Net流程,每周崩溃一次或两次。 I have the AppDomain.CurrentDomain.UnhandledException event hooked up to log4net and the event never gets fired!
我有连接到log4net的AppDomain.CurrentDomain.UnhandledException事件,事件永远不会被触发! The process just crashes with logging anything!
记录任何事情都会导致进程崩溃! This looks like a .Net runtime/CLR bug as I just get a message in the Event Log saying ".NET Runtime 2.0 Error".
这看起来像.Net运行时/ CLR错误,因为我在事件日志中收到一条消息“.NET Runtime 2.0 Error”。
I am running .Net 3.0 Sp1. 我正在运行.Net 3.0 Sp1。
Can some please help me figure out how to fix this? 有人可以帮我弄清楚如何解决这个问题吗?
Event log message: .NET Runtime 2.0 Error Type: Error Event Id: 1000 事件日志消息: .NET Runtime 2.0错误类型:错误事件ID:1000
Event log description: Faulting application appName.exe, version 0.0.0.0, stamp 4ca5d33d, faulting module mscorwks.dll, version 2.0.50727.3607, stamp 4add5446, debug? 事件日志描述:错误应用程序appName.exe,版本0.0.0.0,邮票4ca5d33d,错误模块mscorwks.dll,版本2.0.50727.3607,邮票4add5446,调试? 0, fault address 0x0010724e.
0,故障地址0x0010724e。
I believe that a StackOverflowException would not be caught like this, as there's nowhere for the code to run. 我相信不会像这样捕获StackOverflowException,因为代码无处运行。 This would possibly be a good candidate for something that occurs on a reasonably regular basis - you may need to check through your code for infinite loops/recursion.
这可能是合理定期发生的事情的一个很好的候选者 - 您可能需要检查代码中的无限循环/递归。
也许这是你的解决方案
So, some interesting feedback, but it may also be worth mentioning that different application types may throw exceptions on different event handlers. 所以,一些有趣的反馈,但也可能值得一提的是,不同的应用程序类型可能会在不同的事件处理程序上抛出异常。
For a Windows Service, we should be safe handling 对于Windows服务,我们应该安全处理
static void Main (string[] args)
{
AppDomain.CurrentDomain.UnhandledException +=
CurrentDomain_UnhandledException;
}
For a WinForms application, we should also handle the additional unhandled event handler 对于WinForms应用程序,我们还应该处理额外的未处理事件处理程序
static void Main (string[] args)
{
AppDomain.CurrentDomain.UnhandledException +=
CurrentDomain_UnhandledException;
System.Windows.Forms.Application.ThreadException +=
Application_ThreadException;
}
For a WPF application, a dispatcher event is provided for GUI exceptions 对于WPF应用程序,为GUI异常提供了调度程序事件
static void Main (string[] args)
{
AppDomain.CurrentDomain.UnhandledException +=
CurrentDomain_UnhandledException;
Application.Current.DispatcherUnhandledException +=
Application_DispatcherException;
}
Also worth re-iterating, any unhandled exception typically results in program termination. 同样值得重新迭代, 任何未处理的异常通常会导致程序终止。 Handling these events however gives us a chance to report and identify the root error.
但是,处理这些事件使我们有机会报告并识别根错误。
Additional links that may help 其他可能有用的链接
My question regarding unhandled GUI exceptions (duplicate) 关于未处理的GUI异常的问题(重复)
Try to place a global try // catch on the entry point of your application. 尝试在应用程序的入口点上进行全局尝试// catch。
Hope it helps. 希望能帮助到你。
Here it's talking about this error: http://social.msdn.microsoft.com/Forums/en/clr/thread/2d10da32-3f57-4f9b-a509-e9864fc5bd16 这里是关于这个错误: http : //social.msdn.microsoft.com/Forums/en/clr/thread/2d10da32-3f57-4f9b-a509-e9864fc5bd16
看看错误消息2 ,还包括一个热修复,这可能是也可能不是你的问题http://code.msdn.microsoft.com/KB913384
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.