WPF中Dispatcher.DisableProcessing在现实生活中的常见用途是什么?当我在代码中构建复杂的 UI 时,我可以使用它来暂停渲染和布局吗?
2 回答
As per MSDN:
Disabling dispatcher processing is an advanced method that is intended to eliminate the chance of unrelated reentrancy.
So you're doing some work on the same thread the Dispatcher
is executing on, but you don't want it processing events whilst you do that work. I think the really pertinent point is:
The effects of disabling processing are as follows:
* CLR locks will not pump messages internally.
If I understand this correctly, it means that you can safely lock and not have the dispatcher pump events as a result (which might cause undesired reentrancy).
我可以分享我们最近遇到的一个案例。它来自PropertyChangedEventManager
WPF 内部用于PropertyChanged
事件处理程序管理。当 GUI 死机时,我们已经捕获了堆栈:
0:000> !mk
Thread 0:
SP IP
00:U 00000000002b7ef8 0000000076efc3ea ntdll!ZwWaitForMultipleObjects+0xa
01:U 00000000002b7f00 000007fefcfc1420 KERNELBASE!WaitForMultipleObjectsEx+0xe8
02:U 00000000002b8000 0000000076db1743 kernel32!WaitForMultipleObjectsExImplementation+0xb3
03:U 00000000002b8090 0000000076c28f7d user32!RealMsgWaitForMultipleObjectsEx+0x12a
04:U 00000000002b8130 0000000076c262b2 user32!MsgWaitForMultipleObjectsEx+0x46
05:U 00000000002b8170 000007fefeaeacd6 ole32!CCliModalLoop::BlockFn+0xc2 [d:\w7rtm\com\ole32\com\dcomrem\callctrl.cxx @ 1222]
06:U 00000000002b81c0 000007fefec0a422 ole32!CoWaitForMultipleHandles+0x102 [d:\w7rtm\com\ole32\com\dcomrem\sync.cxx @ 109]
07:U 00000000002b82d0 000007feec2865f2 clr!MsgWaitHelper+0x8e
08:U 00000000002b8340 000007feec286559 clr!Thread::DoAppropriateWaitWorker+0x29b
09:U 00000000002b8440 000007feec2b8591 clr!Thread::DoAppropriateWait+0x7d
0a:U 00000000002b84c0 000007feec286eb1 clr!SynchronizationContextNative::WaitHelper+0x181
0b:M 00000000002b88a0 000007feee7c9c39 System.Windows.Threading.DispatcherSynchronizationContext.Wait(IntPtr[], Boolean, Int32)(+0x29 Native)
0c:U 00000000002b88e0 000007feec19a7f3 clr!CallDescrWorkerInternal+0x83
0d:U 00000000002b8920 000007feec19a6de clr!CallDescrWorkerWithHandler+0x4a
0e:U 00000000002b8960 000007feec19ae76 clr!MethodDescCallSite::CallTargetWorker+0x251
0f:U 00000000002b8b10 000007feec300d01 clr!Thread::DoSyncContextWait+0xc2
10:U 00000000002b8c70 000007feec300c32 clr!Thread::DoAppropriateWaitWorker+0x4867e
11:U 00000000002b8d70 000007feec2b8591 clr!Thread::DoAppropriateWait+0x7d
12:U 00000000002b8df0 000007feec2b883d clr!CLREventBase::WaitEx+0xc0
13:U 00000000002b8e80 000007feec64046d clr!CRWLock::RWWaitForSingleObject+0x4d
14:U 00000000002b8f20 000007feec5b15b7 clr!CRWLock::StaticAcquireReaderLock+0x3b99af
15:U 00000000002b8f80 000007feec1f7ba7 clr!CRWLock::StaticAcquireReaderLockPublic+0xa7
16:M 00000000002b90f0 000007feee7f2a9c System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(System.Object, System.ComponentModel.PropertyChangedEventArgs)(+0x6 IL,+0xfc Native)
17:M 00000000002b9250 000007fe91bf5243 Telerik.Windows.Controls.GridView.GridViewDataControl.set_CurrentCellInfo(Telerik.Windows.Controls.GridViewCellInfo)(+0x0 IL,+0x313 Native) [c:\projects\Stride\Telerik_UI_for_WPF_Source_2015_1_0401\Controls\GridView\GridView\GridView\GridViewDataControl.cs @ 1019,5]
18:M 00000000002b92c0 000007fe9219b3f7 Telerik.Windows.Controls.GridView.GridViewCell.OnGotFocus(System.Windows.RoutedEventArgs)(+0x37 IL,+0xa7 Native) [c:\projects\Stride\Telerik_UI_for_WPF_Source_2015_1_0401\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs @ 1176,6]
19:M 00000000002b9340 000007feedb8a36f System.Windows.UIElement.IsFocused_Changed(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)(+0x26 IL,+0xaf Native)
1a:M 00000000002b9380 000007feee7d6a0d System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)(+0x52 IL,+0xdd Native)
1b:M 00000000002b9410 000007fee366e285 System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)(+0xa IL,+0x275 Native)
1c:M 00000000002b97f0 000007feee7d668a System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)(+0x2 IL,+0xfa Native)
1d:M 00000000002b9960 000007feee7d359c System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Wind(+0x3f8 IL,+0x54c Native)
1e:M 00000000002b9c90 000007feee7d25be System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)(+0x2bb IL,+0x31e Native)
1f:M 00000000002b9e10 000007feee7d90c1 System.Windows.DependencyObject.SetValue(System.Windows.DependencyPropertyKey, System.Object)(+0xb1 Native)
20:M 00000000002b9e90 000007feedbf3d9e System.Windows.Input.FocusManager.OnFocusedElementChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)(+0x4f IL,+0xee Native)
21:M 00000000002b9ee0 000007feee7d6a0d System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)(+0x52 IL,+0xdd Native)
22:M 00000000002b9f70 000007fee366e285 System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)(+0xa IL,+0x275 Native)
23:M 00000000002ba350 000007feee7d668a System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)(+0x2 IL,+0xfa Native)
24:M 00000000002ba4c0 000007feee7d359c System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Wind(+0x3f8 IL,+0x54c Native)
25:M 00000000002ba7f0 000007feee7d25be System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)(+0x2bb IL,+0x31e Native)
26:M 00000000002ba970 000007feee7d6fd1 System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, System.Object)(+0xa1 Native)
27:M 00000000002ba9e0 000007fee36d5d0f System.Windows.FrameworkElement.OnGotKeyboardFocus(System.Object, System.Windows.Input.KeyboardFocusChangedEventArgs)(+0x10 IL,+0x7f Native)
28:M 00000000002baa40 000007feedb9a8a6 System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)(+0xa IL,+0x56 Native)
29:M 00000000002baaa0 000007feedb9a090 System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)(+0xf0 IL,+0x270 Native)
2a:M 00000000002bacd0 000007feedb8744e System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)(+0x61 IL,+0x14e Native)
2b:M 00000000002bad60 000007feedb838a4 System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)(+0x16 IL,+0x64 Native)
2c:M 00000000002badc0 000007feedbaedaa System.Windows.Input.InputManager.ProcessStagingArea()(+0x1f1 IL,+0x42a Native)
2d:M 00000000002bae60 000007feedbb389e System.Windows.Input.KeyboardDevice.ChangeFocus(System.Windows.DependencyObject, Int32)(+0x284 IL,+0x63e Native)
2e:M 00000000002baef0 000007feedbb2624 System.Windows.Input.KeyboardDevice.Focus(System.Windows.DependencyObject, Boolean, Boolean, Boolean)(+0x4e IL,+0x94 Native)
2f:M 00000000002baf60 000007feedbb2491 System.Windows.Input.KeyboardDevice.Focus(System.Windows.IInputElement)(+0x5f IL,+0x31 Native)
30:M 00000000002bafc0 000007feedb79bcf System.Windows.Interop.HwndKeyboardInputProvider.OnSetFocus(IntPtr)(+0xaf IL,+0x10f Native)
31:M 00000000002bb0e0 000007feedb9423b System.Windows.Interop.HwndKeyboardInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)(+0x1e1 IL,+0x54b Native)
32:M 00000000002bb2a0 000007feedb932f1 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)(+0x8e IL,+0x141 Native)
33:M 00000000002bb310 000007feee7cb45a MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)(+0x39 IL,+0x14a Native)
34:M 00000000002bb3c0 000007feee7cb2e0 MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)(+0x5b IL,+0x80 Native)
35:M 00000000002bb410 000007feee7cb15a System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)(+0x7e IL,+0x5a Native)
36:M 00000000002bb470 000007feee7cb0e7 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)(+0x11 IL,+0x47 Native)
37:M 00000000002bb4d0 000007feee7c846c System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)(+0xce IL,+0x2bc Native)
38:M 00000000002bb570 000007feee7ca9d0 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)(+0x129 IL,+0x140 Native)
39:M 00000000002bb670 000007feee9759d7 DomainBoundILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)
3a:U 00000000002bb700 000007feec1fb42e clr!UMThunkStub+0x6e
3b:U 00000000002bb790 0000000076c29bd1 user32!UserCallWinProcCheckWow+0x1ad
3c:U 00000000002bb850 0000000076c272cb user32!DispatchClientMessage+0xc3
3d:U 00000000002bb8b0 0000000076c26829 user32!_fnDWORD+0x2d
3e:U 00000000002bb910 0000000076efbd75 ntdll!KiUserCallbackDispatcherContinue
3f:U 00000000002bb998 0000000076c2685a user32!ZwUserMessageCall+0xa
40:U 00000000002bb9a0 0000000076c268a2 user32!RealDefWindowProcWorker+0xa4
41:U 00000000002bba70 0000000076c2760e user32!RealDefWindowProcW+0x5a
42:U 00000000002bbab0 0000000076c275a4 user32!DefWindowProcW+0xfc
43:U 00000000002bbb00 0000000076c29bd1 user32!UserCallWinProcCheckWow+0x1ad
44:U 00000000002bbbc0 0000000076c23bfc user32!CallWindowProcAorW+0xdc
45:U 00000000002bbc10 0000000076c23b78 user32!CallWindowProcW+0x18
46:M 00000000002bbc50 000007feee7cb599 MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr, Int32, IntPtr, IntPtr)(+0x9 IL,+0xb9 Native)
47:M 00000000002bbd40 000007feee9759d7 DomainBoundILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)
48:U 00000000002bbdd0 000007feec1fb42e clr!UMThunkStub+0x6e
49:U 00000000002bbe60 0000000076c29bd1 user32!UserCallWinProcCheckWow+0x1ad
4a:U 00000000002bbf20 0000000076c23bfc user32!CallWindowProcAorW+0xdc
4b:U 00000000002bbf70 0000000076c23b78 user32!CallWindowProcW+0x18
4c:M 00000000002bbfb0 000007feee7caa86 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)(+0x154 IL,+0x1f6 Native)
4d:M 00000000002bc0b0 000007feee9759d7 DomainBoundILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)
4e:U 00000000002bc140 000007feec1fb42e clr!UMThunkStub+0x6e
4f:U 00000000002bc1d0 0000000076c29bd1 user32!UserCallWinProcCheckWow+0x1ad
50:U 00000000002bc290 0000000076c272cb user32!DispatchClientMessage+0xc3
51:U 00000000002bc2f0 0000000076c26829 user32!_fnDWORD+0x2d
52:U 00000000002bc350 0000000076efbd75 ntdll!KiUserCallbackDispatcherContinue
53:U 00000000002bc3d8 0000000076c2908a user32!NtUserPeekMessage+0xa
54:U 00000000002bc3e0 0000000076c29055 user32!PeekMessageW+0x105
55:U 00000000002bc430 000007fefebaff92 ole32!CCliModalLoop::MyPeekMessage+0x52 [d:\w7rtm\com\ole32\com\dcomrem\callctrl.cxx @ 1733]
56:U 00000000002bc4a0 000007fefebb0109 ole32!CCliModalLoop::PeekRPCAndDDEMessage+0x49 [d:\w7rtm\com\ole32\com\dcomrem\callctrl.cxx @ 1500]
57:U 00000000002bc510 000007fefeb3e153 ole32!CCliModalLoop::BlockFn+0x5353f
58:U 00000000002bc560 000007fefec0a422 ole32!CoWaitForMultipleHandles+0x102 [d:\w7rtm\com\ole32\com\dcomrem\sync.cxx @ 109]
59:U 00000000002bc670 000007feec2865f2 clr!MsgWaitHelper+0x8e
5a:U 00000000002bc6e0 000007feec286559 clr!Thread::DoAppropriateWaitWorker+0x29b
5b:U 00000000002bc7e0 000007feec2b8591 clr!Thread::DoAppropriateWait+0x7d
5c:U 00000000002bc860 000007feec286eb1 clr!SynchronizationContextNative::WaitHelper+0x181
5d:M 00000000002bcc40 000007feee7c9c39 System.Windows.Threading.DispatcherSynchronizationContext.Wait(IntPtr[], Boolean, Int32)(+0x29 Native)
5e:U 00000000002bcc80 000007feec19a7f3 clr!CallDescrWorkerInternal+0x83
5f:U 00000000002bccc0 000007feec19a6de clr!CallDescrWorkerWithHandler+0x4a
60:U 00000000002bcd00 000007feec19ae76 clr!MethodDescCallSite::CallTargetWorker+0x251
61:U 00000000002bceb0 000007feec300d01 clr!Thread::DoSyncContextWait+0xc2
62:U 00000000002bd010 000007feec300c32 clr!Thread::DoAppropriateWaitWorker+0x4867e
63:U 00000000002bd110 000007feec2b8591 clr!Thread::DoAppropriateWait+0x7d
64:U 00000000002bd190 000007feec2b883d clr!CLREventBase::WaitEx+0xc0
65:U 00000000002bd220 000007feec64046d clr!CRWLock::RWWaitForSingleObject+0x4d
66:U 00000000002bd2c0 000007feec5b0e98 clr!CRWLock::StaticAcquireWriterLock+0x3b98e8
67:U 00000000002bd310 000007feec1f77d7 clr!CRWLock::StaticAcquireWriterLockPublic+0xa7
68:M 00000000002bd480 000007feee7dca9a System.ComponentModel.PropertyChangedEventManager.AddListener(System.ComponentModel.INotifyPropertyChanged, System.String, System.Windows.IWeakEventListener, System.EventHandler`1<System.ComponentModel.PropertyChangedEventArgs>)(+0x4a Native)
69:M 00000000002bd500 000007feee7dc8d7 System.ComponentModel.PropertyChangedEventManager.AddHandler(System.ComponentModel.INotifyPropertyChanged, System.EventHandler`1<System.ComponentModel.PropertyChangedEventArgs>, System.String)(+0x37 Native)
6a:M 00000000002bd550 000007fee36bc902 MS.Internal.Data.PropertyPathWorker.ReplaceItem(Int32, System.Object, System.Object)(+0x584 IL,+0x702 Native)
6b:M 00000000002bd690 000007fee36bbcbc MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32, System.ComponentModel.ICollectionView, System.Object, Boolean)(+0xa7 IL,+0x13c Native)
6c:M 00000000002bd710 000007fee412602d MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32, System.ComponentModel.ICollectionView)(+0x0 IL,+0x3d Native)
6d:M 00000000002bd760 000007fee36f3a2e MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(System.Object, System.String)(+0x1b IL,+0x5e Native)
6e:M 00000000002bd7a0 000007feee7dcf19 System.Windows.WeakEventManager+ListenerList`1[[System.__Canon, mscorlib]].DeliverEvent(System.Object, System.EventArgs, System.Type)(+0x54 IL,+0xa9 Native)
6f:M 00000000002bd850 000007feee7b7863 System.Windows.WeakEventManager.DeliverEventToList(System.Object, System.EventArgs, ListenerList)(+0xf IL,+0x33 Native)
70:M 00000000002bd8a0 000007feee7f300d System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(System.Object, System.ComponentModel.PropertyChangedEventArgs)(+0x1de IL,+0x66d Native)
71:U 00000000002bda00 000007fe8cce0111 CLRStub[StubLinkStub]@7fe8cce0111
72:M 00000000002bdac0 000007fe8f6f38c2 *** WARNING: Unable to verify checksum for MyCompany.Core.dll
*** ERROR: Module load completed but symbols could not be loaded for MyCompany.Core.dll
MyCompany.Core.ComponentModel.PropertyChangedNotifiableExtension.SetValue[[System.__Canon, mscorlib]](MyCompany.Core.ComponentModel.IPropertyChangedNotifiableEx, System.ComponentModel.PropertyChangedEventArgs, System.__Canon ByRef, System.__Canon, S(+0x5c IL,+0x1a2 Native)
73:M 00000000002bdb20 000007fe8f6f36f2 MyCompany.Core.ComponentModel.NotifyPropertyChangedBase.SetValue[[System.__Canon, mscorlib]](System.ComponentModel.PropertyChangedEventArgs, System.__Canon ByRef, System.__Canon)(+0x0 IL,+0xd2 Native)
74:U 00000000002bdb80 000007feec29f0b7 clr!InstantiatingMethodStubWorker+0xc7
75:M 00000000002bdc40 000007fe923d56f1 *** WARNING: Unable to verify checksum for MyCompany.Modules.dll
*** ERROR: Module load completed but symbols could not be loaded for MyCompany.Modules.dll
MyCompany.Modules.Blotters.ViewModels.MyViewModel.SetOrders(MyCompany.Modules.Models.MyModel[], MyCompany.Modules.Models.MyModel[])(+0xd IL,+0x31 Native)
76:M 00000000002bdc80 000007feee7cb228 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)(+0x3f IL,+0x128 Native)
77:M 00000000002bdce0 000007feee7cb0e7 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)(+0x11 IL,+0x47 Native)
78:M 00000000002bdd40 000007feee7ce9f1 System.Windows.Threading.DispatcherOperation.InvokeImpl()(+0x9e IL,+0x281 Native)
79:M 00000000002bde00 000007feeb0839a5 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)(+0x72 IL,+0x285 Native)
7a:M 00000000002bdf60 000007feeb083719 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)(+0x0 IL,+0x9 Native)
7b:M 00000000002bdf90 000007feeb0836f7 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)(+0x57 Native)
7c:M 00000000002bdfe0 000007feee7ce621 System.Windows.Threading.DispatcherOperation.Invoke()(+0x20 IL,+0x71 Native)
7d:M 00000000002be060 000007feee7c9063 System.Windows.Threading.Dispatcher.ProcessQueue()(+0xf0 IL,+0x2e3 Native)
7e:M 00000000002be130 000007feee7c93c3 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)(+0x45 IL,+0xb3 Native)
7f:M 00000000002be1f0 000007feee7cb45a MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)(+0x39 IL,+0x14a Native)
80:M 00000000002be2a0 000007feee7cb2e0 MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)(+0x5b IL,+0x80 Native)
81:M 00000000002be2f0 000007feee7cb15a System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)(+0x7e IL,+0x5a Native)
82:M 00000000002be350 000007feee7cb0e7 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)(+0x11 IL,+0x47 Native)
83:M 00000000002be3b0 000007feee7c846c System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)(+0xce IL,+0x2bc Native)
84:M 00000000002be450 000007feee7ca9d0 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)(+0x129 IL,+0x140 Native)
85:M 00000000002be550 000007feee9759d7 DomainBoundILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)
86:U 00000000002be5e0 000007feec1fb42e clr!UMThunkStub+0x6e
87:U 00000000002be670 0000000076c29bd1 user32!UserCallWinProcCheckWow+0x1ad
88:U 00000000002be730 0000000076c298da user32!DispatchMessageWorker+0x3b5
89:M 00000000002be7b0 000007feee7f5900 DomainBoundILStubClass.IL_STUB_PInvoke(System.Windows.Interop.MSG ByRef)
8a:M 00000000002be880 000007feee7c7332 System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)(+0x48 IL,+0x112 Native)
8b:M 00000000002be920 000007fee361f2ea System.Windows.Application.RunInternal(System.Windows.Window)(+0xf0 IL,+0x17a Native)
8c:M 00000000002be9c0 000007fee361ebf7 System.Windows.Application.Run()(+0x67 Native)
8d:M 00000000002bea00 000007fe8cc80100 *** WARNING: Unable to verify checksum for exe
*** ERROR: Module load completed but symbols could not be loaded for exe
XamlGeneratedNamespace.GeneratedApplication.Main()(+0x0 IL,+0x70 Native)
8e:U 00000000002bea40 000007feec19a7f3 clr!CallDescrWorkerInternal+0x83
8f:U 00000000002bea80 000007feec19a6de clr!CallDescrWorkerWithHandler+0x4a
90:U 00000000002beac0 000007feec19ae76 clr!MethodDescCallSite::CallTargetWorker+0x251
91:U 00000000002bec70 000007feec327749 clr!RunMain+0x1e7
92:U 00000000002bee50 000007feec327a8e clr!Assembly::ExecuteMainMethod+0xb6
93:U 00000000002bf140 000007feec327987 clr!SystemDomain::ExecuteMainMethod+0x506
94:U 00000000002bf750 000007feec32790a clr!ExecuteEXE+0x3f
95:U 00000000002bf7c0 000007feec327862 clr!_CorExeMainInternal+0xae
96:U 00000000002bf850 000007feec324174 clr!CorExeMain+0x14
97:U 00000000002bf890 000007fef78a72fd mscoreei!CorExeMain+0xe0
98:U 00000000002bf8e0 000007fef7a25b21 mscoree!CorExeMain_Exported+0x57
99:U 00000000002bf910 0000000076da59dd kernel32!BaseThreadInitThunk+0xd
9a:U 00000000002bf940 0000000076eda631 ntdll!RtlUserThreadStart+0x1d
这里的堆栈模式显示它是一个重入:
4f:U 00000000002bc1d0 0000000076c29bd1 user32!UserCallWinProcCheckWow+0x1ad
50:U 00000000002bc290 0000000076c272cb user32!DispatchClientMessage+0xc3
51:U 00000000002bc2f0 0000000076c26829 user32!_fnDWORD+0x2d
52:U 00000000002bc350 0000000076efbd75 ntdll!KiUserCallbackDispatcherContinue
53:U 00000000002bc3d8 0000000076c2908a user32!NtUserPeekMessage+0xa
54:U 00000000002bc3e0 0000000076c29055 user32!PeekMessageW+0x105
55:U 00000000002bc430 000007fefebaff92 ole32!CCliModalLoop::MyPeekMessage+0x52 [d:\w7rtm\com\ole32\com\dcomrem\callctrl.cxx @ 1733]
56:U 00000000002bc4a0 000007fefebb0109 ole32!CCliModalLoop::PeekRPCAndDDEMessage+0x49 [d:\w7rtm\com\ole32\com\dcomrem\callctrl.cxx @ 1500]
57:U 00000000002bc510 000007fefeb3e153 ole32!CCliModalLoop::BlockFn+0x5353f
58:U 00000000002bc560 000007fefec0a422 ole32!CoWaitForMultipleHandles+0x102 [d:\w7rtm\com\ole32\com\dcomrem\sync.cxx @ 109]
绑定时的PropertyChangedEventManager
用途ReaderWriterLock
发生了变化,因此我们必须DisableProcessing
在更改视图模型中的属性时避免该问题。