我有一段时间处于挂起状态的.NET窗体窗体应用程序。当我把流程转储并通过WinDbg/SOS打开它时,它显示一个线程有一个对kernel32!WaitForMultipleObjectsEx
的调用,但我没有在该特定方法的任何事件对象上调用任何WaitXXX API。在我正在对InvokedRequired和IsDisposed API进行检查时说过。是否调用InvokedRequired或IsDisposed API在内部调用任何WaitXXX API?为什么在这个方法中看到对WaitForMultipleObjectsEx的调用?
这是线程的调用堆栈。
[HelperMethodFrame_1OBJ: 0e4eedc0] System.Threading.WaitHandle.WaitOneNative(Microsoft.Win32.SafeHandles.SafeWaitHandle, UInt32, Boolean, Boolean)
0e4eee6c 67b7689f System.Threading.WaitHandle.WaitOne(Int64, Boolean)
0e4eee88 67b76855 System.Threading.WaitHandle.WaitOne(Int32, Boolean)
0e4eee9c 65c21a4f System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle)
0e4eeeb0 65f5d68b System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)
0e4eef50 65c233ac System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[])
0e4eef84 65c2334f System.Windows.Forms.Control.Invoke(System.Delegate)
0e4eef88 6715ad76 MyNameSpace.MyClass.MyMethod()
0e4eefb0 67b96e96 System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
0e4eefbc 67ba031f System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
0e4eefd4 67b96e14 System.Threading.ThreadHelper.ThreadStart()
0e4ef1fc 68f81b4c [GCFrame: 0e4ef1fc]
为什么你不告诉我们当时你的代码在做什么? – Gabe