我们的应用程序在某些计算机上崩溃,因为它们有一些激活 WPF 自动化对等点的软件。有没有办法知道哪个应用程序正在激活它们?
我们有一个堆栈跟踪,显示以下代码:
System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) Line 54 + 0x16 bytes C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.CatchException(System.Exception e) Line 2978 Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.CatchExceptionStatic(object source, System.Exception e) Line 2962 + 0x9 bytes Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.CatchException(object source, System.Exception e, System.Delegate catchHandler) Line 177 + 0xd bytes Unknown
WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) Line 43 + 0x17 bytes Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Line 1447 + 0x2d bytes Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 398 Unknown
[Native to Managed Transition]
[Managed to Native Transition]
UIAutomationTypes.dll!System.Windows.Automation.AutomationIdentifier.Register(MS.Internal.Automation.UiaCoreTypesApi.AutomationIdType type, System.Guid guid, string programmaticName) + 0x31 bytes
UIAutomationTypes.dll!System.Windows.Automation.InvokePatternIdentifiers.InvokePatternIdentifiers() + 0x4b bytes
[Native to Managed Transition]
[Managed to Native Transition]
PresentationCore.dll!System.Windows.Automation.Peers.AutomationPeer.Initialize() Line 1840 + 0x28 bytes Unknown
PresentationCore.dll!System.Windows.Automation.Peers.AutomationPeer.AutomationPeer() Line 278 + 0x5 bytes Unknown
[Native to Managed Transition]
[Managed to Native Transition]
PresentationCore.dll!System.Windows.Automation.Peers.AutomationPeer.RaiseFocusChangedEventHelper(System.Windows.IInputElement newFocus) Line 387 Unknown
PresentationCore.dll!System.Windows.Input.KeyboardDevice.ChangeFocus(System.Windows.DependencyObject focus, int timestamp) Line 565 + 0x17 bytes Unknown
PresentationCore.dll!System.Windows.Input.KeyboardDevice.TryChangeFocus(System.Windows.DependencyObject newFocus, System.Windows.Input.IKeyboardInputProvider keyboardInputProvider, bool askOld, bool askNew, bool forceToNullIfFailed) Line 443 + 0xc bytes Unknown
PresentationCore.dll!System.Windows.Input.KeyboardDevice.Focus(System.Windows.DependencyObject focus, bool askOld, bool askNew, bool forceToNullIfFailed) Line 220 + 0x19 bytes Unknown
PresentationCore.dll!System.Windows.Input.KeyboardDevice.Focus(System.Windows.IInputElement element) Line 181 Unknown
PresentationCore.dll!System.Windows.Interop.HwndKeyboardInputProvider.OnSetFocus(System.IntPtr hwnd) Line 558 Unknown
PresentationCore.dll!System.Windows.Interop.HwndKeyboardInputProvider.FilterMessage(System.IntPtr hwnd, MS.Internal.Interop.WindowMessage message, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 379 Unknown
PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 1757 + 0x1b bytes Unknown
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 345 + 0x16 bytes Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Line 494 + 0x18 bytes Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 111 + 0xa bytes Unknown
WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) Line 41 + 0x17 bytes Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Line 1447 + 0x2d bytes Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 398 Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.DefWndProcWrapper(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 672 + 0x29 bytes Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 424 + 0x1a bytes Unknown
[Native to Managed Transition]
[Managed to Native Transition]
PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox) + 0x120 bytes
PresentationFramework.dll!System.Windows.Window.Show() + 0x5c bytes
PresentationFramework.dll!System.Windows.Window.ShowDialog() + 0x27d bytes
您可以在调用堆栈的中间看到自动化 API 触发。在大多数机器上,这不会发生,并且应用程序运行良好。
我们可以解决真正的问题,但鉴于这发生在非常小的一组机器上,我认为停止启用自动化子系统的应用程序会更快。