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更新导致了这个问题,其中github中也有这个问题:
https://github.com/dotnet/wpf/issues/8056
再和我当前有问题的这台电脑比较,发现了这个更新可能有问题:KB5011048
卸载后重启,软件正常。
备注:
下一篇:dns劫持有什么危害