WPF启动失败报System.Windows.Automation.Peers.AutomationPeer.Initialize()错误解决
创始人
2024-11-23 02:37:02
0

问题描述

win10系统上WPF程序启动后就崩溃,通过查看崩溃日志如下:

应用程序: xxx.exe
Framework 版本: v4.0.30319
说明: 由于未经处理的异常,进程终止。
异常信息: System.TypeLoadException
在 System.Windows.Automation.Peers.AutomationPeer.Initialize()
在 System.Windows.Automation.Peers.AutomationPeer…cctor()

这里是引用

异常信息: System.TypeInitializationException 在
System.Windows.Automation.Peers.AutomationPeer.RaiseFocusChangedEventHelper(System.Windows.IInputElement)

System.Windows.Input.KeyboardDevice.ChangeFocus(System.Windows.DependencyObject,
Int32) 在
System.Windows.Input.KeyboardDevice.TryChangeFocus(System.Windows.DependencyObject,
System.Windows.Input.IKeyboardInputProvider, Boolean, Boolean,
Boolean) 在
System.Windows.Input.KeyboardDevice.Focus(System.Windows.DependencyObject,
Boolean, Boolean, Boolean) 在
System.Windows.Input.KeyboardDevice.Focus(System.Windows.IInputElement)
在 System.Windows.Interop.HwndKeyboardInputProvider.OnSetFocus(IntPtr)

System.Windows.Interop.HwndKeyboardInputProvider.FilterMessage(IntPtr,
MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef) 在
System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32,
IntPtr, IntPtr, Boolean ByRef) 在
MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean
ByRef) 在
MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) 在
System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate,
System.Object, Int32) 在
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object,
System.Delegate, System.Object, Int32, System.Delegate) 在
System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority,
System.TimeSpan, System.Delegate, System.Object, Int32) 在
MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

解决方案:

方案一:升级windows系统

如果当前系统有升级,手动升级系统,一般系统问题都可以通过升级来解决

方案二:卸载windows更新

通过查找资料和猜测,可能是windows更新导致了这个问题,其中github中也有这个问题:
https://github.com/dotnet/wpf/issues/8056
再和我当前有问题的这台电脑比较,发现了这个更新可能有问题:KB5011048
在这里插入图片描述

卸载后重启,软件正常。
备注:

  1. 如果发现软件今天运行正常,第二天再运行时出现如上错误,大概率就是更新出现了问题,可以通过这个方法去排除。
  2. KB5011048不一定是唯一,有时可能需要具体问题具体分析,但都可以从这个更新包入手

相关内容

热门资讯

透视经验!德普之星辅助工具如何... 透视经验!德普之星辅助工具如何设置,德普之星app安卓版破解版(透视)原来有脚本挂(哔哩哔哩)1)德...
透视策略!wepoker私局辅... 透视策略!wepoker私局辅助,werplan辅助软件(透视)一直真的是有挂(哔哩哔哩)1、wep...
透视经验!wejoker私人辅... 透视经验!wejoker私人辅助软件,wepoker一直输的号能继续打吗(透视)确实有脚本app(哔...
透视技法!hhpoker辅助软... 透视技法!hhpoker辅助软件是真的么,德普之星辅助工具如何设置(透视)原来有挂(哔哩哔哩)1、完...
透视绝活儿!德普之星透视辅助软... 透视绝活儿!德普之星透视辅助软件是真的吗,德普之星辅助器app(透视)果然真的有脚本教程(哔哩哔哩)...
透视资料!hhpoker德州真... 透视资料!hhpoker德州真的假的,wpk有那种辅助吗(透视)一贯有挂(哔哩哔哩)hhpoker德...
透视模板!wejoker免费脚... 透视模板!wejoker免费脚本,wepoker如何设置透视(透视)其实真的有脚本工具(哔哩哔哩)一...
透视资料!epoker有透视吗... 透视资料!epoker有透视吗,wepoker透视功能下载(透视)原来是真的挂(哔哩哔哩)1、操作简...
透视绝活儿!wepoker亲友... 透视绝活儿!wepoker亲友圈有用吗,wepoker国外版透视(透视)原来真的是有透视器(哔哩哔哩...
透视方针!aapoker怎么设... 透视方针!aapoker怎么设置抽水,哈糖大菠萝助手(透视)果然是有挂(哔哩哔哩)1、aapoker...