Unreproducible totally random and rare (once/twice per month) "Failed to set Win32 parent window of the Control" error #14212
Unanswered
bukkidemeSemilab
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear folks,
I know it is a veeeeery long shot, but I would like to ask around here too.
Anyone has seen such error msgs from .NET8 and .NET10 Winforms? We have a large codebase (cannot share it unfortunatelly), based on Winforms. The framework uses TABControl, and several tab pages (some of them use splitContainers, sub- tabControls, etc.). For many years, the code was built and run under Framework 4.8, without any such error. However, when we migrated to .NET8, then in last year to .NET10, we started to get these errors. They seem to be totally random, sometimes twice a day, sometimes no error for a month. It looks like the bug is always triggered when a user clicks on the TAB control and changes tab page. We worked a lot in the last few weeks to eliminate any possible issues in the code which might trigger it. But no real success yet.
The error cannot be catched in a way so the app can run on, when this error starts, the UI and its elements go "haywire", losing some controls randomly, and throwing this error again and again. App restart solves it, and then might be no issue for a month.
This is the err msg, always the same. We tried different ways to catch the error, but it comes from deep of Winforms code, we even managed to probe and debug into the app during runtime when the error was present, but we could not see any relevant info except some 2handler codes".
Anyone, any idea, what else we could try, or what it can be?
We run the app under .NET10.0.1 runtime, Windows10 x64.
Thanks very much for any advice! :)
Have a nice day,
Best Regards! :)
`2026.01.05 13:10:43.620.0 ERROR: ThreadException in System.Windows.Forms: Failed to set Win32 parent window of the Control.
----- StackTrace -----
at System.Windows.Forms.Control.SetParentHandle(HWND value)
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.TabControl.UpdateTabSelection(Boolean updateFocus)
at System.Windows.Forms.TabControl.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, UInt32 msg, WPARAM wparam, LPARAM lparam)
----- Environment.StackTrace -----
at System.Environment.get_StackTrace()
at *******************logException(String prefix, Exception ex) in **************\MainForm.cs:line 245
at *****.MainForm.ThreadException(Object sender, ThreadExceptionEventArgs e) in *******\MainForm.cs:line 269
at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception ex)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, UInt32 msg, WPARAM wparam, LPARAM lparam)
at Windows.Win32.PInvoke.g__LocalExternFunction|2733_0(WINDOW_EX_STYLE dwExStyle, PCWSTR lpClassName, PCWSTR lpWindowName, WINDOW_STYLE dwStyle, Int32 X, Int32 Y, Int32 nWidth, Int32 nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, Void lpParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.TabControl.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.TabControl.UpdateTabSelection(Boolean updateFocus)
at System.Windows.Forms.TabControl.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.TabControl.WmSelChange()
at System.Windows.Forms.TabControl.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, UInt32 msg, WPARAM wparam, LPARAM lparam)
at Windows.Win32.PInvokeCore.g__LocalExternFunction|8598_0(HWND hWnd, UInt32 Msg, WPARAM wParam, LPARAM lParam)
at Windows.Win32.PInvokeCore.g__LocalExternFunction|8598_0(HWND hWnd, UInt32 Msg, WPARAM wParam, LPARAM lParam)
at System.Windows.Forms.Control.WmNotify(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, UInt32 msg, WPARAM wparam, LPARAM lparam)
at Windows.Win32.PInvokeCore.CallWindowProc( lpPrevWndFunc, HWND hWnd, UInt32 Msg, WPARAM wParam, LPARAM lParam)
at Windows.Win32.PInvokeCore.CallWindowProc( lpPrevWndFunc, HWND hWnd, UInt32 Msg, WPARAM wParam, LPARAM lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, UInt32 msg, WPARAM wparam, LPARAM lparam)
at Windows.Win32.PInvoke.DispatchMessage(MSG lpMsg)
at System.Windows.Forms.Application.LightThreadContext.FPushMessageLoop(msoloop uReason)
at System.Windows.Forms.Application.LightThreadContext.RunMessageLoop(msoloop reason, Boolean fullModal)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(msoloop reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at **********************\Program.cs:line 48
ActiveForm: MainForm, Handle=3016142
ActiveControl: splitContainer
TargetSite: System.Windows.Forms.Control`
Beta Was this translation helpful? Give feedback.
All reactions