【发布时间】:2012-03-28 15:36:13
【问题描述】:
我有一个挂在 OnUserPreferenceChanged 事件上的多线程 .NET 应用程序。这通常是由在后台线程上启动的 UI 控件或消息循环引起的(参见例如http://www.ikriv.com/en/prog/info/dotnet/MysteriousHang.html),但据我所知,这里并非如此。我通过在 WindowsFormsSynchronizationContext 中设置断点来验证这一点(如此处建议的 http://www.aaronlerch.com/blog/2008/12/15/debugging-ui/),它只在主 UI 线程中构造一次。
这是windbg中 !clrstack 的输出:
0013eea8 7c90e514 [HelperMethodFrame_1OBJ: 0013eea8] System.Threading.WaitHandle.WaitOneNative(Microsoft.Win32.SafeHandles.SafeWaitHandle, UInt32,布尔值,布尔值)0013ef54 792b68af System.Threading.WaitHandle.WaitOne(Int64, Boolean) 0013ef70 792b6865 System.Threading.WaitHandle.WaitOne(Int32, Boolean) 0013ef84 7b6f1a4f System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle) 0013ef98 7ba2d68b System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate、System.Object[]、布尔值)0013f038 7b6f33ac System.Windows.Forms.Control.Invoke(System.Delegate,System.Object[]) 0013f06c 7b920bd7 System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threading.SendOrPostCallback, System.Object) 0013f084 7a92ed62 Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(布尔值, System.Object[]) 0013f0b8 7a92dc8f Microsoft.Win32.SystemEvents.RaiseEvent(布尔,System.Object, System.Object[]) 0013f104 7a92e227 Microsoft.Win32.SystemEvents.OnUserPreferenceChanged(Int32,IntPtr, IntPtr) 0013f124 7aaa06ec Microsoft.Win32.SystemEvents.WindowProc(IntPtr, Int32, IntPtr, IntPtr)
我可以获取参数信息的最后一种方法是:
0013f084 7a92ed62 Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(布尔值, 系统.对象[]) 参数: 这 = 0x01404420 checkFinalization = 0x00000001 args = 0x0144a298
这是我的问题:如何在此处获取更多信息?最终,我想知道这个 Invoke 用于哪些对象和/或线程。像“!do 0x01404420”或“!do 0x0144a298”之类的东西,但我不知道从那里去哪里。
【问题讨论】: