Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around bug in WPF when running in .NET Core #2618

Merged

Conversation

cwensley
Copy link
Member

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)

It has been fixed in the WPF repo, see dotnet/wpf#4181 and dotnet/wpf#7345, but hasn't been merged into a release yet so we override the automation peer and catch the exception there.

@cwensley cwensley added the bug label Feb 14, 2024
@cwensley cwensley added this to the 2.8.3 milestone Feb 14, 2024
@cwensley cwensley force-pushed the curtis/wpf-fix-random-crashes-in-netcore branch from 0b16f37 to 051d935 Compare February 14, 2024 18:44
@cwensley cwensley merged commit d0fd54b into picoe:develop Feb 14, 2024
3 checks passed
@cwensley cwensley deleted the curtis/wpf-fix-random-crashes-in-netcore branch February 14, 2024 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant