【发布时间】:2009-10-26 14:18:04
【问题描述】:
我继承的代码不断崩溃,并出现以下错误(根本没有改变):
System.ObjectDisposedException: Safe handle has been closed
at Microsoft.Win32.UnsafeNativeMethods.GetOverlappedResult(
SafeFileHandle hFile, NativeOverlapped* lpOverlapped,
Int32& lpNumberOfBytesTransferred, Boolean bWait)
at System.IO.Ports.SerialStream.EventLoopRunner.WaitForCommEvent()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.
ExecuteCodeWithGuaranteedCleanup(
TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(
ExecutionContext executionContext, ContextCallback callback,
Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
这只是因为之前的开发人员添加了AppDomain.UnhandledException Event 而被捕获。
如果我删除它,应用程序只会崩溃并显示 Dr Watson 消息(发送反馈等),而不是通常的 .NET 对话框(带有继续选项和堆栈跟踪)。
我查过了,和Thread.Abort没有关系
我如何尝试从堆栈跟踪中找到导致此问题的原因,而不是在应用程序的代码中?
【问题讨论】: