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

GetWindowText: Win32Exception (0x80004005): The parameter is incorrect #3892

Closed
punker76 opened this issue Jul 24, 2020 · 0 comments · Fixed by #3893
Closed

GetWindowText: Win32Exception (0x80004005): The parameter is incorrect #3892

punker76 opened this issue Jul 24, 2020 · 0 comments · Fixed by #3893
Labels
Milestone

Comments

@punker76
Copy link
Member

Describe the bug

Imported from ControlzEx #117

This issue started after we updated our projects to ControlzEx 4.2.2 from 3.0.2.4 and at first we thought it was similar or may be related to #103 but that was resolved in 4.2.1. I'm not making any GetWindowText calls in my code, we're using the MahApps MetroWindow which uses ControlzEx I believe, but this has been tricky for us to recreate consistently.

Actual behavior

System.ComponentModel.Win32Exception (0x80004005): 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.ContextLayoutManager.fireAutomationEvents()
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   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)

@punker76 punker76 added the Bug label Jul 24, 2020
@punker76 punker76 added this to the 2.2.0 milestone Jul 24, 2020
punker76 added a commit that referenced this issue Jul 24, 2020
Make some extra checks before calling GetWindowTextLength and GetWindowText to prevent Win32Exception.
punker76 added a commit that referenced this issue Jul 24, 2020
…Exception

Add MetroWindowAutomationPeer to prevent Win32Exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant