winforms
winforms copied to clipboard
After reducing the form width, clicking the ToolStrip options triggers a Win32Exception error
.NET version
.NET SDK 10.0.00-rtm.25523.111
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No, it still repro on .NET 8.0 and .NET 9.0
Issue description
When the form width is reduced to prevent Toolstrip items from displaying, clicking the ToolBar Options throws a System.ComponentModel.Win32Exception (0x80004005): Failed to set Win32 parent window of the Control error.
.NET project
.NET framework project
Call Stack
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ComponentModel.Win32Exception (0x80004005): Failed to set Win32 parent window of the Control.
at System.Windows.Forms.Control.SetParentHandle(HWND value)
at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, UInt32 msg, WPARAM wparam, LPARAM lparam)
Steps to reproduce
- Create a WinForms .NET project
- Add a ToolStrip to form designer
- Add toolStripComboBox and toolStripProgressBar to ToolStrip control
- Ctrl + F5 to run this project
- Narrow down the width of form to make sure no toolstrip Item display on form designer
- Click on the ToolBar Options