线程池内的异步线程创建UI控件,造成UI线程卡死无响应的问题分析

winform应用在使用一段时间后,切换到其他系统或者打开word、excel文档,再切换回winform应用时,系统有时出现不响应的现象。有时在锁屏后恢复桌面及应用时也发生此问题。

经微软支持确认,是因为 https://blogs.msdn.microsoft.com/dsui_team/2012/10/31/debugging-windows-forms-application-hangs-during-systemevents-userpreferencechanged/

Winform控件会自动订阅系统事件,如果在异步线程中创建UI控件,主线程会通过SynchronizationContext将系统事件同步给其他辅助线程。

但是,如果创建Winform窗体的后台线程没有消息循环处理机制(routinely pumps messages),当UserPreferencesChanged发生时,主线程无法通过SynchronizationContext机制把事件发送到后台线程,因此Hang

如下便是问题发生后的dump堆栈,主线程在等待辅助线程的同步消息:

0:000> !clrstack
OS Thread Id: 0x2ae8 (0)
Child SP       IP Call Site
0075e994 77d022cc [HelperMethodFrame_1OBJ: 0075e994] System.Threading.WaitHandle.WaitOneNative
(System.Runtime.InteropServices.SafeHandle, UInt32, Boolean, Boolean)
0075ea78 524a2f21 System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean) [f:dd
dpclrsrcBCLsystem	hreadingwaithandle.cs @ 243]
0075ea90 524a2ee8 System.Threading.WaitHandle.WaitOne(Int32, Boolean) [f:dd
dpclrsrcBCLsystem	hreadingwaithandle.cs @ 194]
0075eaa4 517112fc *** WARNING: Unable to verify checksum for System.Windows.Forms.ni.dll
System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle)
0075eae4 51a8e25e System.Windows.Forms.Control.MarshaledInvoke
(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)
0075eae8 5171382b [InlinedCallFrame: 0075eae8]
0075eb70 5171382b System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[])
0075eba4 51940376 System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threading.SendOrPostCallback, System.Object)
0075ebbc 54c59108 *** WARNING: Unable to verify checksum for System.ni.dll
Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(Boolean, System.Object[])
0075ebf0 54b46b58 Microsoft.Win32.SystemEvents.RaiseEvent(Boolean, System.Object, System.Object[])
0075ec44 54b461c0 Microsoft.Win32.SystemEvents.OnUserPreferenceChanging
(Int32, IntPtr, IntPtr)
0075ec64 54d61a9a Microsoft.Win32.SystemEvents.WindowProc(IntPtr, Int32, IntPtr, IntPtr)
0075ec68 00d5d1a2 [InlinedCallFrame: 0075ec68]
0075ee98 00d5d1a2 [InlinedCallFrame: 0075ee98]
0075ee94 5117ad58 DomainBoundILStubClass.IL_STUB_PInvoke(MSG ByRef)
0075ee98 51129571 [InlinedCallFrame: 0075ee98] System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
0075eecc 51129571 System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
0075eed0 51129182 [InlinedCallFrame: 0075eed0]
0075ef58 51129182 System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
0075efa8 51128ff4 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
0075efd4 51111dc5 System.Windows.Forms.Application.Run(System.Windows.Forms.Form)
0075efe8 09454187 xxxxxxxx.Platform.AppFrameworkGui.Commands.StartWorkbenchCommand.Run(System.String[])
0075effc 09452f1b *** WARNING: Unable to verify checksum for GSFramework.exe
*** ERROR: Module load completed but symbols could not be loaded for GSFramework.exe
xxxxxxxx.Platform.FrameworkGui.Portal.FrameworkMain.RunApplication()
0075f034 0270ae8c xxxxxxxx.Platform.FrameworkGui.Portal.FrameworkMain.Run()
0075f0a4 02701ce8 xxxxxxxx.Platform.FrameworkGui.Portal.FrameworkMain.Main(System.String[])
0075f2b8 5960eaf6 [GCFrame: 0075f2b8]



但是当问题发生之后,辅助线程的有效堆栈已经不存在了,如何才能定位到启动异步线程并构造了UI控件的有效堆栈呢?

微软最初的建议是Review关于ThreadPool的代码,但这是有很大难度的:一是代码量很大、肉眼难以有效识别,源代码也是在动态变化的;二是可能有对线程池的封装或变种(BackGroundWorker、System.Threading.Timer、System.Timers.Timer、Task等内部都是通过ThreadPool实现的);

另外的一个办法就是live debug,但是也存在诸多缺陷(无法稳定重现),每次重启进程后需要重新设置debug跟踪。最后借用辅助代码工具(Freezer),频繁触发UserPreferenceChanged事件,加大出现问题的概率。


Using Windbg to Determine When Windows Forms Controls Are Created

Locate the address of the constructor for System.Windows.Forms.Application+MarshalingControl. We do this using !name2ee along with the module name for the DLL (you can use * to search all modules), and the fully qualified method name.

0:000>!name2ee System_Windows_Forms_ni System.Windows.Forms.Application+MarshalingControl..ctor

Module: 7a981000 (System.Windows.Forms.dll)
Token: 0x060017d8
MethodDesc: 7a99cbcc
Name: System.Windows.Forms.Application+MarshalingControl..ctor()
JITTED Code Address: 7ab46fc0

7ab46fc0 is the address we want to place a breakpoint on. This breakpoint should be hit the first time a Control is created on a thread. It will dump the managed callstack to the output window and then continue on with normal execution.

0:000> bp 7ab46fc0 ".echo MarshalingControl creation detected. Callstack follows.;!clrstack;.echo ==============================;gc"


然而在生产环境很多时候当我们attach到活动进程的时候可能已经晚了,因为异步线程构造UI的代码可能已经执行过了。

所以我们推荐的方式是使用windbg直接启动应用程序,并进入调试状态,此时.net clr、core等DLL尚未加载,还不能load sos.dll。

合适的时机是在加载.NET原生Form的DLL文件时,开始跟踪。实践证明这个方法时有效的。

CommandLine: "C:Documents and Settingslangchao桌面TestTkkXXXXXXXX.exe"
Symbol search path is: c:procdumpsymbols
Executable search path is:
(934.ba4): Break instruction exception - code 80000003 (first chance)
eax=00251eb4 ebx=7ffd5000 ecx=00000001 edx=00000002 esi=00251f48 edi=00251eb4
eip=7c92120e esp=0012fb20 ebp=0012fc94 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
ntdll!DbgBreakPoint:
7c92120e cc              int     3
0:000> sxe ld System.Windows.Forms
0:000> g
(934.ba4): Unknown exception - code 04242420 (first chance)
ModLoad: 7b350000 7bfe9000   C:WINDOWSassemblyNativeImages_v4.0.30319_32System.Windows.Formsf1a434e0ca8754bc64e407e097be1a80System.Windows.Forms.ni.dll
eax=00000000 ebx=00000000 ecx=03f30000 edx=7c92e514 esi=00000000 edi=00000000
eip=7c92e514 esp=0012b090 ebp=0012b184 iopl=0         nv up ei ng nz ac pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000296
ntdll!KiFastSystemCallRet:
7c92e514 c3              ret
0:000> .loadby sos clr
0:000> !name2ee System_Windows_Forms_ni System.Windows.Forms.Application+MarshalingControl..ctor
Module:      7b351000
Assembly:    System.Windows.Forms.dll
Token:       060017e8
MethodDesc:  7b370994
Name:        System.Windows.Forms.Application+MarshalingControl..ctor()
JITTED Code Address: 7b503e18
0:000> bp 7b503e18 ".echo ==MarshalingControl created detected. Callstack follows.; !clrstack;.echo=================================;gc"
*** WARNING: Unable to verify checksum for C:WINDOWSassemblyNativeImages_v4.0.30319_32System.Windows.Formsf1a434e0ca8754bc64e407e097be1a80System.Windows.Forms.ni.dll
0:000> g
(934.ba4): CLR exception - code e0434352 (first chance)
(934.ba4): CLR exception - code e0434352 (first chance)
(934.ba4): CLR exception - code e0434352 (first chance)
(934.ba4): CLR exception - code e0434352 (first chance)
==MarshalingControl created detected. Callstack follows.
OS Thread Id: 0xba4 (0)
Child SP IP       Call Site
0012f174 7b503e18 System.Windows.Forms.Application+MarshalingControl..ctor()
0012f178 7b5676f3 System.Windows.Forms.Application+ThreadContext.get_MarshalingControl()
0012f1ac 7b56730c System.Windows.Forms.WindowsFormsSynchronizationContext..ctor()
0012f1c0 7b567201 System.Windows.Forms.WindowsFormsSynchronizationContext.InstallIfNeeded()
0012f1ec 7b566387 System.Windows.Forms.Control..ctor(Boolean)
0012f2b0 7b56de98 System.Windows.Forms.ScrollableControl..ctor()
0012f2cc 7b56ddbf System.Windows.Forms.ContainerControl..ctor()
0012f2e0 7b566083 System.Windows.Forms.Form..ctor()
0012f2fc 03f36620 UserLogin.LoginForm..ctor()
0012f318 03f36074 XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain.Run()
0012f37c 03f30ace XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain.Main(System.String[])
0012f648 7914219b [GCFrame: 0012f648]
=================================
==MarshalingControl created detected. Callstack follows.
OS Thread Id:0x858 (7)
Child SP IP       Call Site
054ede64 7b503e18 System.Windows.Forms.Application+MarshalingControl..ctor()
054ede68 7b5676f3 System.Windows.Forms.Application+ThreadContext.get_MarshalingControl()
054ede9c 7b56730c System.Windows.Forms.WindowsFormsSynchronizationContext..ctor()
054edeb0 7b567201 System.Windows.Forms.WindowsFormsSynchronizationContext.InstallIfNeeded()
054ededc 7b566387 System.Windows.Forms.Control..ctor(Boolean)
054edfa0 7b514958 System.Windows.Forms.ProgressBar..ctor()
054edfc0 7b5148ab System.Windows.Forms.ToolStripProgressBar.CreateControlInstance()
054edfcc 7b51487f System.Windows.Forms.ToolStripProgressBar..ctor()
054edfd8 03f37abd XXXXXXXX.Platform.AppFrameworkGui.Gui.SdStatusBar..ctor()
054edffc 03f369b4 XXXXXXXX.Platform.AppFrameworkGui.Core.StatusBarService.initcomponent()
054ee0f4 03f36504 XXXXXXXX.Platform.AppFrameworkGui.Core.StatusBarService..cctor()
054ee350 7914219b [GCFrame: 054ee350]
054eed5c 7914219b [PrestubMethodFrame: 054eed5c] XXXXXXXX.Platform.AppFrameworkGui.Core.StatusBarService.get_StatusBarViewContent()
054eed6c 03f36416 XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain+<>c.<Run>b__38_0(System.Object, System.ComponentModel.DoWorkEventArgs)
054eed74 7a9a73d3 System.ComponentModel.BackgroundWorker.OnDoWork(System.ComponentModel.DoWorkEventArgs)*** WARNING: Unable to verify checksum for C:WINDOWSassemblyNativeImages_v4.0.30319_32Systemc4a662ee8493a4f347f81bb7c575fc54System.ni.dll

054eed88 7a9a7628 System.ComponentModel.BackgroundWorker.WorkerThreadStart(System.Object)
054eefa8 7914219b [HelperMethodFrame_PROTECTOBJ: 054eefa8] System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr, System.Object[], System.Object, Int32, Boolean, System.Object[] ByRef)
054ef2fc 7a1dcc6a System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessageSink)*** WARNING: Unable to verify checksum for C:WINDOWSassemblyNativeImages_v4.0.30319_32mscorlibdb92d128972cadfdc312fe8cca58659mscorlib.ni.dll

054ef360 7a1f2fe9 System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.DoAsyncCall()
054ef36c 7a1f2fa8 System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(System.Object)
054ef374 79b2dab1 System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
054ef37c 79ab4d95 System.Threading.ExecutionContext.runTryCode(System.Object)
054ef7b4 7914219b [HelperMethodFrame_PROTECTOBJ: 054ef7b4] System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
054ef818 79ab4c9a System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
054ef830 79ab7fa2 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
054ef854 79afb6e2 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
054ef868 79afaf6f System.Threading.ThreadPoolWorkQueue.Dispatch()
054ef8b4 79afae15 System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
054efc74 7914219b [DebuggerU2MCatchHandlerFrame: 054efc74]
=================================
(934.ba4): Guard page violation - code 80000001 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00610509 ebx=00000006 ecx=08e30005 edx=00610509 esi=07ee3008 edi=00000006
eip=4aeeb3d2 esp=0012e284 ebp=0012e2ac iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
gdiplus!GdipSetStringFormatLineAlign+0x2076:
4aeeb3d2 8801            mov     byte ptr [ecx],al          ds:0023:08e30005=00
0:000> g
(934.ef8): CLR exception - code e0434352 (first chance)
(934.ba4): Unknown exception - code 000006ba (first chance)
(934.ba4): Unknown exception - code 000006ba (first chance)
(934.858): C++ EH exception - code e06d7363 (first chance)
(934.858): C++ EH exception - code e06d7363 (first chance)
(934.858): C++ EH exception - code e06d7363 (first chance)
(934.858): CLR exception - code e0434352 (first chance)
(934.858): C++ EH exception - code e06d7363 (first chance)
(934.858): C++ EH exception - code e06d7363 (first chance)
(934.858): C++ EH exception - code e06d7363 (first chance)
(934.858): CLR exception - code e0434352 (first chance)
(934.ba4): CLR exception - code e0434352 (first chance)
(934.6cc): Break instruction exception - code 80000003 (first chance)
eax=7ffd5000 ebx=00000001 ecx=00000002 edx=00000003 esi=00000004 edi=00000005
eip=7c92120e esp=03e0ffcc ebp=03e0fff4 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00000246
ntdll!DbgBreakPoint:
7c92120e cc              int     3
0:000> !clrstack
OS Thread Id: 0xba4 (0)
Child SP IP       Call Site
0012eccc 7c92e514 [HelperMethodFrame_1OBJ: 0012eccc] System.Threading.WaitHandle.WaitOneNative
(System.Runtime.InteropServices.SafeHandle, UInt32, Boolean, Boolean)
0012ed74 79b2b80f System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean)
0012ed90 79b2b7cd System.Threading.WaitHandle.WaitOne(Int32, Boolean)
0012eda8 7babe3b4 System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle)
0012edc0 7be6a513 System.Windows.Forms.Control.MarshaledInvoke
(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)
0012edc4 7bac0284 [InlinedCallFrame: 0012edc4]
0012ee64 7bac0284 System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[])
0012ee98 7bd43b4b System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threading.SendOrPostCallback, System.Object)
0012eeb0 7adde7ff Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(Boolean, System.Object[])
0012eee4 7adde60c Microsoft.Win32.SystemEvents.RaiseEvent(Boolean, System.Object, System.Object[])
0012ef34 7adddc0f Microsoft.Win32.SystemEvents.OnUserPreferenceChanging
(Int32, IntPtr, IntPtr)
0012ef54 7afa8926 Microsoft.Win32.SystemEvents.WindowProc(IntPtr, Int32, IntPtr, IntPtr)
0012ef58 00c72f20 [InlinedCallFrame: 0012ef58]
0012f0fc 00c72f20 [InlinedCallFrame: 0012f0fc]
0012f0f8 7b586bac DomainBoundILStubClass.IL_STUB_PInvoke(MSG ByRef)
0012f0fc 7b57a92f [InlinedCallFrame: 0012f0fc] System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
0012f140 7b57a92f System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
0012f144 7b57a55c [InlinedCallFrame: 0012f144]
0012f1dc 7b57a55c System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
0012f234 7b57a3b1 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
0012f264 7baba473 System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form)
0012f278 7baf6763 System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)
0012f27c 7baf63c7 [InlinedCallFrame: 0012f27c]
0012f314 7baf63c7 System.Windows.Forms.Form.ShowDialog()
0012f318 03f3610b XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain.Run()
0012f37c 03f30ace XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain.Main(System.String[])
0012f648 7914219b [GCFrame: 0012f648]
0:000> !dso
OS Thread Id: 0xba4 (0)
ESP/REG  Object   Name
0012EBE4 00ea7ec0 System.Windows.Forms.WindowsFormsSynchronizationContext
0012ECF4 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012ED08 0c1b1724 System.Threading.ManualResetEvent
0012ED0C 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012ED14 00e9ae00 System.Collections.Hashtable
0012ED20 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012ED4C 0c1b173c Microsoft.Win32.SafeHandles.SafeWaitHandle
0012ED74 0c1b1724 System.Threading.ManualResetEvent
0012ED94 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012ED98 0c1b1724 System.Threading.ManualResetEvent
0012EDAC 0c1b152c System.Windows.Forms.Control+MultithreadSafeCallScope
0012EDEC 00ea5928 System.Windows.Forms.PropertyStore
0012EDF4 0c1b1670 System.Collections.Queue
0012EDF8 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012EDFC 0c1b1630 System.Windows.Forms.Control+ThreadMethodEntry
0012EE00 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012EE04 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012EE0C 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012EE14 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012EE44 0c1b152c System.Windows.Forms.Control+MultithreadSafeCallScope
0012EE48 0c1b14f8 System.Threading.SendOrPostCallback
0012EE4C 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012EE5C 0c1b1518 System.Object[]    (System.Object[])
0012EE60 0c1b14f8 System.Threading.SendOrPostCallback
0012EE64 0c1b152c System.Windows.Forms.Control+MultithreadSafeCallScope
0012EE80 00eaa19c Microsoft.Win32.SystemEvents+SystemEventInvokeInfo
0012EE84 00ea58c0 System.Windows.Forms.Application+MarshalingControl
0012EE88 0c1b14f8 System.Threading.SendOrPostCallback
0012EE94 0c1b1518 System.Object[]    (System.Object[])
0012EE98 0c1b1518 System.Object[]    (System.Object[])
0012EE9C 0c1b14f8 System.Threading.SendOrPostCallback
0012EEA0 00ea580c System.Windows.Forms.WindowsFormsSynchronizationContext
0012EEAC 0c1ae20c System.Object[]    (System.Object[])
0012EEB0 00eaa19c Microsoft.Win32.SystemEvents+SystemEventInvokeInfo
0012EEE0 0c1ae20c System.Object[]    (System.Object[])
0012EEE8 00ea1fd0 System.Object
0012EEEC 0c1ae230 System.Object[]    (Microsoft.Win32.SystemEvents+SystemEventInvokeInfo[])
0012EEF0 00ea20e8 System.Object
0012EF1C 0c1ae20c System.Object[]    (System.Object[])
0012EF20 00ea2274 Microsoft.Win32.SystemEvents
0012EF24 00ea20e8 System.Object
0012EF30 0c1ae20c System.Object[]    (System.Object[])
0012EF3C 00ea2274 Microsoft.Win32.SystemEvents
0012EF60 0c153500 DevExpress.XtraBars.Ribbon.RibbonBarManager
0012F0AC 00e9ae74 System.Windows.Forms.Application+ThreadContext
0012F12C 00e9ae74 System.Windows.Forms.Application+ThreadContext
0012F16C 00ff7ca4 System.Windows.Forms.NativeMethods+MSG[]
0012F170 00e9ae74 System.Windows.Forms.Application+ThreadContext
0012F178 00ff7834 System.Windows.Forms.Application+ComponentManager
0012F1C0 0c548df4 System.Windows.Forms.Application+ModalApplicationContext
0012F1E4 00ea416c UserLogin.LoginForm
0012F1E8 00ea416c UserLogin.LoginForm
0012F1F0 00e9ae74 System.Windows.Forms.Application+ThreadContext
0012F21C 0c548df4 System.Windows.Forms.Application+ModalApplicationContext
0012F220 00e9ae74 System.Windows.Forms.Application+ThreadContext
0012F230 00ff7734 System.Windows.Forms.Application+ModalApplicationContext
0012F248 0c548df4 System.Windows.Forms.Application+ModalApplicationContext
0012F24C 00ea416c UserLogin.LoginForm
0012F250 0c548df4 System.Windows.Forms.Application+ModalApplicationContext
0012F254 00e9ae74 System.Windows.Forms.Application+ThreadContext
0012F260 0c548df4 System.Windows.Forms.Application+ModalApplicationContext
0012F26C 00ea74b0 System.Windows.Forms.PropertyStore
0012F2AC 00ea416c UserLogin.LoginForm
0012F2FC 00ea416c UserLogin.LoginForm
0012F300 00ea416c UserLogin.LoginForm
0012F304 00ea416c UserLogin.LoginForm
0012F308 0c548cd8 System.EventHandler
0012F370 00e64cac System.Threading.Thread
0012F388 00ef1548 <unknown type>
0012F38C 00e9ae74 System.Windows.Forms.Application+ThreadContext
0012F394 00e68698 System.Object[]    (System.String[])
0012F3A8 00e68c04 System.String    GSP5.5
0012F3C0 00e68c3c System.String    InstallPath_
0012F3C4 00e9a998 System.String    C:Documents and SettingslangchaoApplication DataInspur
0012F3C8 00e9a998 System.String    C:Documents and SettingslangchaoApplication DataInspur
0012F3E4 00e9aa1c System.String    InstallPath_SHHTKZJSYJS_CJGKPT_PROD.xml
0012F3E8 00e99de4 XXXXXXXX.Platform.AppFrameworkGui.ApplicationInfo
0012F6A0 00e68698 System.Object[]    (System.String[])
0:000> !do 00ea580c
Name:        System.Windows.Forms.WindowsFormsSynchronizationContext
MethodTable: 7b5af010
EEClass:     7b35e1c4
Size:        20(0x14) bytes
File:        C:WINDOWSMicrosoft.NetassemblyGAC_MSILSystem.Windows.Formsv4.0_4.0.0.0__b77a5c561934e089System.Windows.Forms.dll
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
79b7fb50  4000701        4         System.Int32  1 instance        0 _props
7b5ad868  40031d5        8 ...ows.Forms.Control  0 instance 00ea58c0 controlToSendTo
79b9a054  40031d6        c System.WeakReference  0 instance 00ea5820 destinationThreadRef
79ba6820  40031d7      910       System.Boolean  1 TLstatic  dontAutoInstall
    >> Thread:Value <<
79ba6820  40031d8      914       System.Boolean  1 TLstatic  inSyncContextInstallation
    >> Thread:Value <<
79b933b8  40031d9       b0 ...ronizationContext  0 TLstatic  previousSyncContext
    >> Thread:Value <<
0:000> !do 00ea5820
Name:        System.WeakReference
MethodTable: 79b9a054
EEClass:     798d5198
Size:        16(0x10) bytes
File:        C:WINDOWSMicrosoft.NetassemblyGAC_32mscorlibv4.0_4.0.0.0__b77a5c561934e089mscorlib.dll
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
79b9ac20  40006ed        4        System.IntPtr  1 instance   cd12bc m_handle
79ba6820  40006ee        8       System.Boolean  1 instance        0 m_IsLongReference
0:000> dd cd12bc l1
00cd12bc  00ea4de0
0:000> !do 00ea4de0
Name:        System.Threading.Thread
MethodTable: 79ba01c0
EEClass:     798d8ed8
Size:        48(0x30) bytes
File:        C:WINDOWSMicrosoft.NetassemblyGAC_32mscorlibv4.0_4.0.0.0__b77a5c561934e089mscorlib.dll
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
79b88c1c  4000780        4 ....Contexts.Context  0 instance 00000000 m_Context
79b9b65c  4000781        8 ....ExecutionContext  0 instance 00000000 m_ExecutionContext
79b9fba0  4000782        c        System.String  0 instance 00000000 m_Name
79ba0074  4000783       10      System.Delegate  0 instance 00000000 m_Delegate
79ba6598  4000784       14 ...ation.CultureInfo  0 instance 00000000 m_CurrentCulture
79ba6598  4000785       18 ...ation.CultureInfo  0 instance 00000000 m_CurrentUICulture
79b9f7dc  4000786       1c        System.Object  0 instance 00000000 m_ThreadStartArg
79b9ac20  4000787       20        System.IntPtr  1 instance   233600 DONT_USE_InternalThread
79ba2b6c  4000788       24         System.Int32  1 instance        2 m_Priority
79ba2b6c  4000789       28         System.Int32  1 instance        4 m_ManagedThreadId
79b8b910  400078a      18c ...LocalDataStoreMgr  0   shared   static s_LocalDataStoreMgr
    >> Domain:Value  0015d860:NotInit  <<
79b8e4cc  400078b        c ...alDataStoreHolder  0   shared TLstatic s_LocalDataStore
    >> Thread:Value <<
0:000> !threads
ThreadCount:      8
UnstartedThread:  0
BackgroundThread: 6
PendingThread:    0
DeadThread:       1
Hosted Runtime:   no
                                   PreEmptive   GC Alloc                Lock
       ID  OSID ThreadOBJ    State GC           Context       Domain   Count APT Exception
   0    1   ba4 00194f30   2006020 Enabled  0c1b9044:0c1ba938 0015d860     0 STA
   2    2   8f8 00165578      b220 Enabled  00000000:00000000 0015d860     0 MTA (Finalizer)
   5    3   c70 001f22b8   100a220 Enabled  00000000:00000000 0015d860     0 MTA (Threadpool Worker)
   7    4   858 00233600   1009220 Enabled  0c1b2b84:0c1b4938 0015d860     0 MTA (Threadpool Worker)
   8    5   ef8 00234ff0   1009220 Enabled  0c1b5a24:0c1b6938 0015d860     0 MTA (Threadpool Worker)
XXXX    7       05bd3820   1019820 Enabled  00000000:00000000 0015d860     0 Ukn (Threadpool Worker)
  14    8   8cc 09b94130   200b220 Enabled  00000000:00000000 0015d860     1 MTA
   9    a   924 09d0b118   8009220 Enabled  00000000:00000000 0015d860     0 MTA (Threadpool Completion Port)



简单处理后,出现卡死的频率减少了,但仍然存在! 继续使用此法发现还有一处类似代码:

Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
Copyright (c) Microsoft Corporation. All rights reserved.

CommandLine: "C:Documents and Settingsadmin桌面TestTkkXXXXXXXX.exe"
Symbol search path is: *** Invalid ***
****************************************************************************
* Symbol loading may be unreliable without a symbol search path.           *
* Use .symfix to have the debugger choose a symbol path.                   *
* After setting your symbol path, use .reload to refresh symbol locations. *
****************************************************************************
Executable search path is:
ModLoad: 00400000 006e4000   TkkXXXXXXXX.exe
(824.a4c): Break instruction exception - code 80000003 (first chance)
eax=00251eb4 ebx=7ffdc000 ecx=00000001 edx=00000002 esi=00251f48 edi=00251eb4
eip=7c92120e esp=0012fb20 ebp=0012fc94 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll -
ntdll!DbgBreakPoint:
7c92120e cc              int     3
0:000> sxe ld System.Windows.Forms
0:000> g
(824.a4c): Unknown exception - code 04242420 (first chance)
ModLoad: 7b350000 7bfe9000   C:WINDOWSassemblyNativeImages_v4.0.30319_32System.Windows.Formsf1a434e0ca8754bc64e407e097be1a80System.Windows.Forms.ni.dll
eax=00000000 ebx=00000000 ecx=03f30000 edx=7c92e514 esi=00000000 edi=00000000
eip=7c92e514 esp=0012b090 ebp=0012b184 iopl=0         nv up ei ng nz ac pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000296
ntdll!KiFastSystemCallRet:
7c92e514 c3              ret
0:000> .loadby sos clr 
0:000> !name2ee System_Windows_Forms_ni System.Windows.Forms.Application+MarshalingControl..ctor
*********************************************************************
* Symbols can not be loaded because symbol path is not initialized. *
*                                                                   *
* The Symbol Path can be set by:                                    *
*   using the _NT_SYMBOL_PATH environment variable.                 *
*   using the -y <symbol_path> argument when starting the debugger. *
*   using .sympath and .sympath+                                    *
*********************************************************************
PDB symbol for clr.dll not loaded
Module:      7b351000
Assembly:    System.Windows.Forms.dll
Token:       060017e8
MethodDesc:  7b370994
Name:        System.Windows.Forms.Application+MarshalingControl..ctor()
JITTED Code Address: 7b503e18
0:000> bp 7b503e18 ".echo ==MarshalingControl created detected. Callstack follows.; !clrstack;.echo=================================;gc"
*** WARNING: Unable to verify checksum for C:WINDOWSassemblyNativeImages_v4.0.30319_32System.Windows.Formsf1a434e0ca8754bc64e407e097be1a80System.Windows.Forms.ni.dll
*** ERROR: Module load completed but symbols could not be loaded for C:WINDOWSassemblyNativeImages_v4.0.30319_32System.Windows.Formsf1a434e0ca8754bc64e407e097be1a80System.Windows.Forms.ni.dll
0:000> g
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
==MarshalingControl created detected. Callstack follows.
*********************************************************************
* Symbols can not be loaded because symbol path is not initialized. *
*                                                                   *
* The Symbol Path can be set by:                                    *
*   using the _NT_SYMBOL_PATH environment variable.                 *
*   using the -y <symbol_path> argument when starting the debugger. *
*   using .sympath and .sympath+                                    *
*********************************************************************
PDB symbol for clr.dll not loaded
OS Thread Id: 0xa4c (0)
Child SP IP       Call Site
0012f178 7b503e18 System.Windows.Forms.Application+MarshalingControl..ctor()
0012f17c 7b5676f3 System.Windows.Forms.Application+ThreadContext.get_MarshalingControl()
0012f1b0 7b56730c System.Windows.Forms.WindowsFormsSynchronizationContext..ctor()
0012f1c4 7b567201 System.Windows.Forms.WindowsFormsSynchronizationContext.InstallIfNeeded()
0012f1f0 7b566387 System.Windows.Forms.Control..ctor(Boolean)
0012f2b4 7b56de98 System.Windows.Forms.ScrollableControl..ctor()
0012f2d0 7b56ddbf System.Windows.Forms.ContainerControl..ctor()
0012f2e4 7b566083 System.Windows.Forms.Form..ctor()
0012f300 03f363d0 UserLogin.LoginForm..ctor()
0012f31c 03f35fa5 XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain.Run()*** WARNING: Unable to verify checksum for TkkXXXXXXXX.exe
*** ERROR: Module load completed but symbols could not be loaded for TkkXXXXXXXX.exe

0012f37c 03f30ace XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain.Main(System.String[])
0012f648 7914219b [GCFrame: 0012f648]
=================================
(824.aa8): CLR exception - code e0434352 (first chance)
(824.a4c): Guard page violation - code 80000001 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=0250a47d ebx=00000025 ecx=06e50024 edx=0250a47d esi=075c1c00 edi=00000025
eip=4aeeb3d2 esp=0012e284 ebp=0012e2ac iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:WINDOWSWinSxSx86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.6002.23084_x-ww_f3f35550gdiplus.dll -
gdiplus!GdipSetStringFormatLineAlign+0x2076:
4aeeb3d2 8801            mov     byte ptr [ecx],al          ds:0023:06e50024=00
0:000> g
(824.a4c): Guard page violation - code 80000001 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00610509 ebx=00000006 ecx=055b0005 edx=00610509 esi=0764e008 edi=00000006
eip=4aeeb3d2 esp=0012e284 ebp=0012e2ac iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
gdiplus!GdipSetStringFormatLineAlign+0x2076:
4aeeb3d2 8801            mov     byte ptr [ecx],al          ds:0023:055b0005=00
0:000> g
(824.a4c): Unknown exception - code 000006ba (first chance)
(824.a4c): Unknown exception - code 000006ba (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): CLR exception - code e0434352 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
C:WINDOWSsystem32hookdll InitInstance(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): Guard page violation - code 80000001 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=0060851b ebx=00000006 ecx=02ec0005 edx=0060851b esi=0c5e5120 edi=00000006
eip=4aeeb3d2 esp=0012e2a4 ebp=0012e2cc iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
gdiplus!GdipSetStringFormatLineAlign+0x2076:
4aeeb3d2 8801            mov     byte ptr [ecx],al          ds:0023:02ec0005=00
0:000> g
(824.a4c): Guard page violation - code 80000001 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=0060851b ebx=00000006 ecx=02ed0005 edx=0060851b esi=0c5e5120 edi=00000006
eip=4aeeb3d2 esp=0012d8a4 ebp=0012d8cc iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
gdiplus!GdipSetStringFormatLineAlign+0x2076:
4aeeb3d2 8801            mov     byte ptr [ecx],al          ds:0023:02ed0005=00
0:000> g
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
===MarshalingControl created detected. Callstack follows.
OS Thread Id: 0xaa8 (9)
Child SP IP       Call Site
056eeadc 7b503e18 System.Windows.Forms.Application+MarshalingControl..ctor()
056eeae0 7b5676f3 System.Windows.Forms.Application+ThreadContext.get_MarshalingControl()
056eeb14 7b56730c System.Windows.Forms.WindowsFormsSynchronizationContext..ctor()
056eeb28 7b567201 System.Windows.Forms.WindowsFormsSynchronizationContext.InstallIfNeeded()
056eeb54 7b566387 System.Windows.Forms.Control..ctor(Boolean)
056eec18 7b56de98 System.Windows.Forms.ScrollableControl..ctor()
056eec34 7b56ddbf System.Windows.Forms.ContainerControl..ctor()
056eec48 7b566083 System.Windows.Forms.Form..ctor()
056eec64 09269fdc DevExpress.XtraEditors.XtraForm..ctor()
056eec78 0f1ec4db XXXXXXXX.Platform.XFormEngine.Extension.XForm..ctor(System.String, System.String, System.String, XXXXXXXX.Platform.AppFramework.Service.GSPState)
056eeca0 0f1ec27a AddIns.PreLoadXFormCommand.PreLoadForm()
056eecc8 0f1ebe31 AddIns.PreLoadXFormCommand.worker_DoWork(System.Object, System.ComponentModel.DoWorkEventArgs)
056eecf4 7a9a73d3 System.ComponentModel.BackgroundWorker.OnDoWork(System.ComponentModel.DoWorkEventArgs)*** WARNING: Unable to verify checksum for C:WINDOWSassemblyNativeImages_v4.0.30319_32Systemc4a662ee8493a4f347f81bb7c575fc54System.ni.dll
*** ERROR: Module load completed but symbols could not be loaded for C:WINDOWSassemblyNativeImages_v4.0.30319_32Systemc4a662ee8493a4f347f81bb7c575fc54System.ni.dll

056eed08 7a9a7628 System.ComponentModel.BackgroundWorker.WorkerThreadStart(System.Object)
056eef28 7914219b [HelperMethodFrame_PROTECTOBJ: 056eef28] System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr, System.Object[], System.Object, Int32, Boolean, System.Object[] ByRef)
056ef27c 7a1dcc6a System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessageSink)*** WARNING: Unable to verify checksum for C:WINDOWSassemblyNativeImages_v4.0.30319_32mscorlibdb92d128972cadfdc312fe8cca58659mscorlib.ni.dll
*** ERROR: Module load completed but symbols could not be loaded for C:WINDOWSassemblyNativeImages_v4.0.30319_32mscorlibdb92d128972cadfdc312fe8cca58659mscorlib.ni.dll

056ef2e0 7a1f2fe9 System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.DoAsyncCall()
056ef2ec 7a1f2fa8 System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(System.Object)
056ef2f4 79b2dab1 System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
056ef2fc 79ab4d95 System.Threading.ExecutionContext.runTryCode(System.Object)
056ef734 7914219b [HelperMethodFrame_PROTECTOBJ: 056ef734] System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
056ef798 79ab4c9a System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
056ef7b0 79ab7fa2 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
056ef7d4 79afb6e2 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
056ef7e8 79afaf6f System.Threading.ThreadPoolWorkQueue.Dispatch()
056ef834 79afae15 System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
056efbf4 7914219b [DebuggerU2MCatchHandlerFrame: 056efbf4]
=================================
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): CLR exception - code e0434352 (first chance)
(824.794): Unknown exception - code 000006ba (first chance)
(824.29c): Unknown exception - code e0564552 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): CLR exception - code e0434352 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): C++ EH exception - code e06d7363 (first chance)
(824.aa8): CLR exception - code e0434352 (first chance)
(824.aa8): CLR exception - code e0434352 (first chance)
(824.aa8): CLR exception - code e0434352 (first chance)
(824.aa8): CLR exception - code e0434352 (first chance) 
(824.aa8): Access violation - code c0000005 (first chance) 
First chance exceptions are reported before any exception handling. This exception may be expected and handled.
eax=00000000 ebx=10d76c28 ecx=00000000 edx=00000000 esi=10ed0a2c edi=056ee9d0
eip=1845f0c5 esp=056ee970 ebp=056ee9f4 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00210246
1845f0c5 3909            cmp     dword ptr [ecx],ecx  ds:0023:00000000=????????
0:009> g
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): C++ EH exception - code e06d7363 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.19c): Break instruction exception - code 80000003 (first chance)
eax=7ffdc000 ebx=00000001 ecx=00000002 edx=00000003 esi=00000004 edi=00000005
eip=7c92120e esp=03e1ffcc ebp=03e1fff4 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00000246
ntdll!DbgBreakPoint:
7c92120e cc              int     3
0:004> ~0s
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:WINDOWSsystem32USER32.dll -
eax=00000001 ebx=0012d74c ecx=769dec70 edx=7c92e514 esi=00000000 edi=7ffdc000
eip=7c92e514 esp=0012d724 ebp=0012d7c0 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
ntdll!KiFastSystemCallRet:
7c92e514 c3              ret
0:000> !clrstack
OS Thread Id: 0xa4c (0)
Child SP IP       Call Site
0012daa8 7c92e514 [HelperMethodFrame_1OBJ: 0012daa8] System.Threading.WaitHandle.WaitOneNative(System.Runtime.InteropServices.SafeHandle, UInt32, Boolean, Boolean)
0012db50 79b2b80f System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean)
0012db6c 79b2b7cd System.Threading.WaitHandle.WaitOne(Int32, Boolean)
0012db84 7babe3b4 System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle)
0012db9c 7be6a513 System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)
0012dba0 7bac0284 [InlinedCallFrame: 0012dba0]
0012dc40 7bac0284 System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[])
0012dc74 7bd43b4b System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threading.SendOrPostCallback, System.Object)
0012dc8c 1885b1af DevExpress.XtraBars.BarAndDockingController+EventInfo.OnUserPreferenceChanged
(System.Object, Microsoft.Win32.UserPreferenceChangedEventArgs)
0012dcbc 1885b08a DevExpress.XtraBars.BarAndDockingController.OnUserPreferenceChangedInternal(System.Object, Microsoft.Win32.UserPreferenceChangedEventArgs)
0012e274 7914219b [DebuggerU2MCatchHandlerFrame: 0012e274]
0012e240 7914219b [CustomGCFrame: 0012e240]
0012e214 7914219b [GCFrame: 0012e214]
0012e1f8 7914219b [GCFrame: 0012e1f8]
0012e41c 7914219b [HelperMethodFrame_PROTECTOBJ: 0012e41c] System.RuntimeMethodHandle._InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType)
0012e498 79b3d8c9 System.RuntimeMethodHandle.InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.Signature, System.Reflection.MethodAttributes, System.RuntimeType)
0012e4ec 79b3d5bc System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, Boolean)
0012e528 79b3bf1b System.Delegate.DynamicInvokeImpl(System.Object[])
0012e540 7adde85e Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.InvokeCallback(System.Object)
0012eaa8 7914219b [DebuggerU2MCatchHandlerFrame: 0012eaa8]
0012ea74 7914219b [CustomGCFrame: 0012ea74]
0012ea48 7914219b [GCFrame: 0012ea48]
0012ea2c 7914219b [GCFrame: 0012ea2c]
0012ec50 7914219b [HelperMethodFrame_PROTECTOBJ: 0012ec50] System.RuntimeMethodHandle._InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType)
0012eccc 79b3d8c9 System.RuntimeMethodHandle.InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.Signature, System.Reflection.MethodAttributes, System.RuntimeType)
0012ed20 79b3d5bc System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, Boolean)
0012ed5c 79b3bf1b System.Delegate.DynamicInvokeImpl(System.Object[])
0012ed74 7b57b33b System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)
0012ed98 7b57b278 System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object)
0012edc4 7be6bb2f System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)
0012eddc 7b57afe6 System.Windows.Forms.Control.InvokeMarshaledCallbacks()
0012ee1c 7be6a4ee System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)
0012ee20 7bac0284 [InlinedCallFrame: 0012ee20]
0012eec0 7bac0284 System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[])
0012eef4 7bd43b4b System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threading.SendOrPostCallback, System.Object)
0012ef0c 7adde7ff Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(Boolean, System.Object[])
0012ef40 7adde60c Microsoft.Win32.SystemEvents.RaiseEvent(Boolean, System.Object, System.Object[])
0012ef90 7adddb87 Microsoft.Win32.SystemEvents.OnUserPreferenceChanged(Int32, IntPtr, IntPtr)
0012efb0 7afa893c Microsoft.Win32.SystemEvents.WindowProc(IntPtr, Int32, IntPtr, IntPtr)
0012efb4 00c72f20 [InlinedCallFrame: 0012efb4]
0012f158 00c72f20 [InlinedCallFrame: 0012f158]
0012f154 7b586bac DomainBoundILStubClass.IL_STUB_PInvoke(MSG ByRef)
0012f158 7b57a92f [InlinedCallFrame: 0012f158] System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
0012f19c 7b57a92f System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
0012f1a0 7b57a55c [InlinedCallFrame: 0012f1a0]
0012f238 7b57a55c System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
0012f290 7b57a3b1 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
0012f2c0 7b502805 System.Windows.Forms.Application.Run(System.Windows.Forms.Form)
0012f2d4 02e6167f XXXXXXXX.Platform.AppFrameworkGui.Commands.StartWorkbenchCommand.Run(System.String[])
0012f2e8 02e615aa XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain.RunApplication()
0012f31c 03f36093 XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain.Run()
0012f37c 03f30ace XXXXXXXX.Platform.FrameworkGui.Portal.FrameworkMain.Main(System.String[])
0012f648 7914219b [GCFrame: 0012f648]
0:000> !dso
OS Thread Id: 0xa4c (0)
ESP/REG  Object   Name
0012D9C0 10977230 System.Windows.Forms.WindowsFormsSynchronizationContext
0012DAD0 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DAE4 10fcee90 System.Threading.ManualResetEvent
0012DAE8 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DAF0 00e9abc0 System.Collections.Hashtable
0012DAFC 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DB28 10fceea8 Microsoft.Win32.SafeHandles.SafeWaitHandle
0012DB50 10fcee90 System.Threading.ManualResetEvent
0012DB70 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DB74 10fcee90 System.Threading.ManualResetEvent
0012DB88 10fcec98 System.Windows.Forms.Control+MultithreadSafeCallScope
0012DBC8 10d77dc4 System.Windows.Forms.PropertyStore
0012DBD0 10fceddc System.Collections.Queue
0012DBD4 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DBD8 10fced9c System.Windows.Forms.Control+ThreadMethodEntry
0012DBDC 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DBE0 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DBE8 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DBF0 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DC20 10fcec98 System.Windows.Forms.Control+MultithreadSafeCallScope
0012DC24 10fcec64 System.Threading.SendOrPostCallback
0012DC28 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DC38 10fcec84 System.Object[]    (System.Object[])
0012DC3C 10fcec64 System.Threading.SendOrPostCallback
0012DC40 10fcec98 System.Windows.Forms.Control+MultithreadSafeCallScope
0012DC5C 10e0a208 DevExpress.XtraBars.BarAndDockingController+EventInfo
0012DC60 10d77d5c System.Windows.Forms.Application+MarshalingControl
0012DC64 10fcec64 System.Threading.SendOrPostCallback
0012DC70 10fcec84 System.Object[]    (System.Object[])
0012DC74 10fcec84 System.Object[]    (System.Object[])
0012DC78 10fcec50 DevExpress.XtraBars.BarAndDockingController+EventInfo+<>c__DisplayClassc
0012DC7C 10d77ca8 System.Windows.Forms.WindowsFormsSynchronizationContext
0012DC8C 10fcec50 DevExpress.XtraBars.BarAndDockingController+EventInfo+<>c__DisplayClassc
0012DCB8 10fcdae0 Microsoft.Win32.UserPreferenceChangedEventArgs
0012DCBC 10fcdae0 Microsoft.Win32.UserPreferenceChangedEventArgs
0012DCC0 00ea1f68 Microsoft.Win32.SystemEvents
0012DCC4 10fce5d4 System.Collections.Generic.List`1[[DevExpress.XtraBars.BarAndDockingController+EventInfo, DevExpress.XtraBars.v10.2]]
0012DCD4 10fce5d4 System.Collections.Generic.List`1[[DevExpress.XtraBars.BarAndDockingController+EventInfo, DevExpress.XtraBars.v10.2]]
0012DCD8 10e0a208 DevExpress.XtraBars.BarAndDockingController+EventInfo
0012DDB0 00ea1f68 Microsoft.Win32.SystemEvents
0012DDB4 015dd784 Microsoft.Win32.UserPreferenceChangedEventHandler
0012DDE0 10fcdae0 Microsoft.Win32.UserPreferenceChangedEventArgs
0012DFF4 10fcdae0 Microsoft.Win32.UserPreferenceChangedEventArgs
0012DFF8 00ea1f68 Microsoft.Win32.SystemEvents
0012E1B0 015dd784 Microsoft.Win32.UserPreferenceChangedEventHandler
0012E1B8 00ea1f68 Microsoft.Win32.SystemEvents
0012E1C0 10fcdae0 Microsoft.Win32.UserPreferenceChangedEventArgs
0012E2B0 015dd784 Microsoft.Win32.UserPreferenceChangedEventHandler
0012E2B4 10fce5bc System.Object[]    (System.Object[])
0012E3C0 015dd784 Microsoft.Win32.UserPreferenceChangedEventHandler
0012E3C4 10fce5bc System.Object[]    (System.Object[])
0012E3E0 10fcdc7c System.Signature
0012E448 10fce530 System.Collections.Generic.List`1[[System.Reflection.RuntimeMethodInfo, mscorlib]]
0012E44C 015dd784 Microsoft.Win32.UserPreferenceChangedEventHandler
0012E450 10fcdb44 System.RuntimeType
0012E458 10fcdbec System.Reflection.RuntimeMethodInfo
0012E494 10fce5bc System.Object[]    (System.Object[])
0012E498 10fcdbec System.Reflection.RuntimeMethodInfo
0012E49C 10fcdcb0 System.Object[]    (System.RuntimeType[])
0012E4A0 10fcdb44 System.RuntimeType
0012E4A4 00e6bd84 System.RuntimeType
0012E4C8 10fcdb44 System.RuntimeType
0012E4CC 10fcdbec System.Reflection.RuntimeMethodInfo
0012E4DC 10fcdb44 System.RuntimeType
0012E4E4 10fcdc7c System.Signature
0012E4E8 10fce5bc System.Object[]    (System.Object[])
0012E4F0 10fce5bc System.Object[]    (System.Object[])
0012E4F4 015dd784 Microsoft.Win32.UserPreferenceChangedEventHandler
0012E500 015dd784 Microsoft.Win32.UserPreferenceChangedEventHandler
0012E504 10fcdbec System.Reflection.RuntimeMethodInfo
0012E51C 10fcdac8 System.Object[]    (System.Object[])
0012E528 10fcdac8 System.Object[]    (System.Object[])
0012E530 015dd784 Microsoft.Win32.UserPreferenceChangedEventHandler
0012E5F0 10fcdac8 System.Object[]    (System.Object[])
0012E5F4 10fce410 System.Threading.SendOrPostCallback
0012E68C 10fcdce0 System.Security.Permissions.HostProtectionAttribute
0012E7D4 10fcdce0 System.Security.Permissions.HostProtectionAttribute
0012E8A0 10fcdce0 System.Security.Permissions.HostProtectionAttribute
0012E984 10fcdce0 System.Security.Permissions.HostProtectionAttribute
0012E9E0 10fce410 System.Threading.SendOrPostCallback
0012E9E8 10fcdac8 System.Object[]    (System.Object[])
0012EA1C 10fcdb44 System.RuntimeType
0012EAE4 10fce410 System.Threading.SendOrPostCallback
0012EAE8 10fce51c System.Object[]    (System.Object[])
0012EB90 10fcdce0 System.Security.Permissions.HostProtectionAttribute
0012EBF4 10fce410 System.Threading.SendOrPostCallback
0012EBF8 10fce51c System.Object[]    (System.Object[])
0012EC14 10fcccf8 System.Signature
0012EC7C 10fce490 System.Collections.Generic.List`1[[System.Reflection.RuntimeMethodInfo, mscorlib]]
0012EC80 10fce410 System.Threading.SendOrPostCallback
0012EC84 01580acc System.RuntimeType
0012EC8C 10fccc68 System.Reflection.RuntimeMethodInfo
0012EC98 10fcdac8 System.Object[]    (System.Object[])
0012ECC8 10fce51c System.Object[]    (System.Object[])
0012ECCC 10fccc68 System.Reflection.RuntimeMethodInfo
0012ECD0 10fccd2c System.Object[]    (System.RuntimeType[])
0012ECD4 01580acc System.RuntimeType
0012ECD8 00e6bd84 System.RuntimeType
0012ECFC 01580acc System.RuntimeType
0012ED00 10fccc68 System.Reflection.RuntimeMethodInfo
0012ED10 01580acc System.RuntimeType
0012ED18 10fcccf8 System.Signature
0012ED1C 10fce51c System.Object[]    (System.Object[])
0012ED24 10fce51c System.Object[]    (System.Object[])
0012ED28 10fce410 System.Threading.SendOrPostCallback
0012ED34 10fce410 System.Threading.SendOrPostCallback
0012ED38 10fccc68 System.Reflection.RuntimeMethodInfo
0012ED50 10fce430 System.Object[]    (System.Object[])
0012ED5C 10fce430 System.Object[]    (System.Object[])
0012ED60 10fce444 System.Windows.Forms.Control+MultithreadSafeCallScope
0012ED64 10fce450 System.Windows.Forms.Control+ThreadMethodEntry
0012ED8C 10fce450 System.Windows.Forms.Control+ThreadMethodEntry
0012EDAC 10fce450 System.Windows.Forms.Control+ThreadMethodEntry
0012EDB0 10fce444 System.Windows.Forms.Control+MultithreadSafeCallScope
0012EDB4 10fce450 System.Windows.Forms.Control+ThreadMethodEntry
0012EDC8 10fce444 System.Windows.Forms.Control+MultithreadSafeCallScope
0012EDCC 10fce450 System.Windows.Forms.Control+ThreadMethodEntry
0012EDE0 0122dc68 System.Collections.Queue
0012EDE4 10fce450 System.Windows.Forms.Control+ThreadMethodEntry
0012EDE8 00ea3d74 System.Windows.Forms.Application+MarshalingControl
0012EE08 10fce444 System.Windows.Forms.Control+MultithreadSafeCallScope
0012EE48 00ea3ddc System.Windows.Forms.PropertyStore
0012EE50 0122dc68 System.Collections.Queue
0012EE54 00ea3d74 System.Windows.Forms.Application+MarshalingControl
0012EE58 10fce450 System.Windows.Forms.Control+ThreadMethodEntry
0012EE5C 00ea3d74 System.Windows.Forms.Application+MarshalingControl
0012EE60 00ea3d74 System.Windows.Forms.Application+MarshalingControl
0012EE70 00ea3d74 System.Windows.Forms.Application+MarshalingControl
0012EEA0 10fce444 System.Windows.Forms.Control+MultithreadSafeCallScope
0012EEA4 10fce410 System.Threading.SendOrPostCallback
0012EEA8 00ea3d74 System.Windows.Forms.Application+MarshalingControl
0012EEB8 10fce430 System.Object[]    (System.Object[])
0012EEBC 10fce410 System.Threading.SendOrPostCallback
0012EEC0 10fce444 System.Windows.Forms.Control+MultithreadSafeCallScope
0012EEDC 015dd7a4 Microsoft.Win32.SystemEvents+SystemEventInvokeInfo
0012EEE0 00ea3d74 System.Windows.Forms.Application+MarshalingControl
0012EEE4 10fce410 System.Threading.SendOrPostCallback
0012EEF0 10fce430 System.Object[]    (System.Object[])
0012EEF4 10fce430 System.Object[]    (System.Object[])
0012EEF8 10fce410 System.Threading.SendOrPostCallback
0012EEFC 00ea3d50 System.Windows.Forms.WindowsFormsSynchronizationContext
0012EF08 10fcdac8 System.Object[]    (System.Object[])
0012EF0C 015dd7a4 Microsoft.Win32.SystemEvents+SystemEventInvokeInfo
0012EF3C 10fcdac8 System.Object[]    (System.Object[])
0012EF44 00ea1cc4 System.Object
0012EF48 10fcdaec System.Object[]    (Microsoft.Win32.SystemEvents+SystemEventInvokeInfo[])
0012EF4C 00ea1de8 System.Object
0012EF78 10fcdac8 System.Object[]    (System.Object[])
0012EF7C 00ea1f68 Microsoft.Win32.SystemEvents
0012EF80 00ea1de8 System.Object
0012EF8C 10fcdac8 System.Object[]    (System.Object[])
0012EF98 00ea1f68 Microsoft.Win32.SystemEvents
0012EFBC 015da554 DevExpress.XtraBars.Ribbon.RibbonBarManager
0012F108 00e9ac34 System.Windows.Forms.Application+ThreadContext
0012F188 00e9ac34 System.Windows.Forms.Application+ThreadContext
0012F1C8 10979a88 System.Windows.Forms.NativeMethods+MSG[]
0012F1CC 00e9ac34 System.Windows.Forms.Application+ThreadContext
0012F1D4 10978a48 System.Windows.Forms.Application+ComponentManager
0012F24C 00e9ac34 System.Windows.Forms.Application+ThreadContext
0012F27C 00e9ac34 System.Windows.Forms.Application+ThreadContext
0012F28C 10977cfc System.Windows.Forms.ApplicationContext
0012F2A8 015d9368 XXXXXXXX.Platform.AppFrameworkGui.BarManagerWorkbench
0012F2B0 00e9ac34 System.Windows.Forms.Application+ThreadContext
0012F2C0 018da288 XXXXXXXX.Platform.AppFrameworkGui.Commands.StartWorkbenchCommand
0012F2C8 015d9368 XXXXXXXX.Platform.AppFrameworkGui.BarManagerWorkbench
0012F2D8 00e61228 System.String
0012F304 00ea2550 UserLogin.LoginForm
0012F308 00ea2550 UserLogin.LoginForm
0012F30C 00ea2550 UserLogin.LoginForm
0012F370 00e64c64 System.Threading.Thread
0012F394 00e68650 System.Object[]    (System.String[])
0012F3A8 00e68bbc System.String    GSP5.5
0012F3C0 00e68bf4 System.String    InstallPath_
0012F3C4 00e9a754 System.String    C:Documents and SettingslangchaoApplication DataInspur
0012F3C8 00e9a754 System.String    C:Documents and SettingslangchaoApplication DataInspur
0012F3E4 00e9a7d8 System.String    InstallPath_SHHTKZJSYJS_CJZHGKPT_PROD.xml
0012F3E8 00e99ba0 XXXXXXXX.Platform.AppFrameworkGui.ApplicationInfo
0012F6A0 00e68650 System.Object[]    (System.String[])
0:000> !do 10d77ca8
Name:        System.Windows.Forms.WindowsFormsSynchronizationContext
MethodTable: 7b5af010
EEClass:     7b35e1c4
Size:        20(0x14) bytes
File:        C:WINDOWSMicrosoft.NetassemblyGAC_MSILSystem.Windows.Formsv4.0_4.0.0.0__b77a5c561934e089System.Windows.Forms.dll
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
79b7fb50  4000701        4         System.Int32  1 instance        0 _props
7b5ad868  40031d5        8 ...ows.Forms.Control  0 instance 10d77d5c controlToSendTo
79b9a054  40031d6        c System.WeakReference  0 instance 10d77cbc destinationThreadRef
79ba6820  40031d7      910       System.Boolean  1 TLstatic  dontAutoInstall
    >> Thread:Value <<
79ba6820  40031d8      914       System.Boolean  1 TLstatic  inSyncContextInstallation
    >> Thread:Value <<
79b933b8  40031d9       b0 ...ronizationContext  0 TLstatic  previousSyncContext
    >> Thread:Value <<
0:000> !do 10d77cbc
Name:        System.WeakReference
MethodTable: 79b9a054
EEClass:     798d5198
Size:        16(0x10) bytes
File:        C:WINDOWSMicrosoft.NetassemblyGAC_32mscorlibv4.0_4.0.0.0__b77a5c561934e089mscorlib.dll
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
79b9ac20  40006ed        4        System.IntPtr  1 instance   cd56d4 m_handle
79ba6820  40006ee        8       System.Boolean  1 instance        0 m_IsLongReference
0:000> dd cd56d4 l1
00cd56d4  00ea629c
0:000> !do 00ea629c
Name:        System.Threading.Thread
MethodTable: 79ba01c0
EEClass:     798d8ed8
Size:        48(0x30) bytes
File:        C:WINDOWSMicrosoft.NetassemblyGAC_32mscorlibv4.0_4.0.0.0__b77a5c561934e089mscorlib.dll
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
79b88c1c  4000780        4 ....Contexts.Context  0 instance 015867e0 m_Context
79b9b65c  4000781        8 ....ExecutionContext  0 instance 00000000 m_ExecutionContext
79b9fba0  4000782        c        System.String  0 instance 00000000 m_Name
79ba0074  4000783       10      System.Delegate  0 instance 00000000 m_Delegate
79ba6598  4000784       14 ...ation.CultureInfo  0 instance 00000000 m_CurrentCulture
79ba6598  4000785       18 ...ation.CultureInfo  0 instance 00000000 m_CurrentUICulture
79b9f7dc  4000786       1c        System.Object  0 instance 00000000 m_ThreadStartArg
79b9ac20  4000787       20        System.IntPtr  1 instance   2399a0 DONT_USE_InternalThread
79ba2b6c  4000788       24         System.Int32  1 instance        2 m_Priority
79ba2b6c  4000789       28         System.Int32  1 instance        5 m_ManagedThreadId
79b8b910  400078a      18c ...LocalDataStoreMgr  0   shared   static s_LocalDataStoreMgr
    >> Domain:Value  0015d7e0:NotInit  <<
79b8e4cc  400078b        c ...alDataStoreHolder  0   shared TLstatic s_LocalDataStore
    >> Thread:Value <<
0:000> !threads
ThreadCount:      17
UnstartedThread:  0
BackgroundThread: 15
PendingThread:    0
DeadThread:       1
Hosted Runtime:   no
                                   PreEmptive   GC Alloc                Lock
       ID  OSID ThreadOBJ    State GC           Context       Domain   Count APT Exception
   0    1   a4c 00194e98   2006020 Enabled  10fd86f4:10fd96f8 0015d7e0     0 STA
   2    2   dec 00165438      b220 Enabled  00000000:00000000 0015d7e0     0 MTA (Finalizer)
   5    3   c64 001f1548   100a220 Enabled  00000000:00000000 0015d7e0     0 MTA (Threadpool Worker)
   9    5   aa8 002399a0   1009220 Enabled  10fc82f0:10fc96f8 0015d7e0     0 MTA (Threadpool Worker)
XXXX    6       00230cf8   1019820 Enabled  00000000:00000000 0015d7e0     0 Ukn (Threadpool Worker)
  11    7   994 05d9cc80   200b220 Enabled  00000000:00000000 0015d7e0     1 MTA
  13    8   29c 08f5f668   8009220 Enabled  00000000:00000000 0015d7e0     0 MTA (Threadpool Completion Port)
  14    4   63c 0902ca00   8009220 Enabled  00000000:00000000 0015d7e0     0 MTA (Threadpool Completion Port)
  15    9   ec4 0903f100   200b220 Enabled  10fd3a40:10fd56f8 0015d7e0     0 MTA
  17    a   470 0906db98   1009220 Enabled  10fd1d14:10fd36f8 0015d7e0     0 MTA (Threadpool Worker)
  19    b   794 090dacc0       220 Enabled  00000000:00000000 0015d7e0     0 STA
  35    c   4bc 09134cc8   200b220 Enabled  00000000:00000000 0015d7e0     0 MTA
  29    d   e3c 0912f488       220 Enabled  00000000:00000000 0015d7e0     0 STA
  38    e   c44 17189098   200b220 Enabled  00000000:00000000 0015d7e0     0 MTA
  39    f   ccc 1718dae0   200b220 Enabled  00000000:00000000 0015d7e0     0 MTA
  40   10   e78 1711ec28   8009220 Enabled  00000000:00000000 0015d7e0     0 MTA (Threadpool Completion Port)
  41   11   a04 171e0ab0   200b220 Enabled  00000000:00000000 0015d7e0     0 MTA
0:000> g
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)
(824.a4c): CLR exception - code e0434352 (first chance)


将此两处的代码做下调整:

1、与显示UI相关的异步操作进行拆分,后台逻辑异步执行,创建UI放到backgroundworker的completed事件中处理(即在主线程创建)

2、以预加载为目的相关的操作,改为new Thread方式,并且将线程运行模式改为STA

经验证后问题修复,Good luck!

原文地址:https://www.cnblogs.com/zhaoguan_wang/p/8042229.html