WPF can cause crashes with the following stack trace, seemingly in random places:
System.ComponentModel.Win32Exception (87): The parameter is incorrect.
at MS.Win32.UnsafeNativeMethods.GetWindowText(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount)
at System.Windows.Automation.Peers.WindowAutomationPeer.GetNameCore()
at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
at System.Windows.Automation.Peers.AutomationPeer.UpdatePeer(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
WPF can cause crashes with the following stack trace, seemingly in random places:
It has been fixed in the WPF repo, see https://github.com/dotnet/wpf/issues/4181 and https://github.com/dotnet/wpf/pull/7345, but hasn't been merged into a release yet so we override the automation peer and catch the exception there.