winforms icon indicating copy to clipboard operation
winforms copied to clipboard

After reducing the form width, clicking the ToolStrip options triggers a Win32Exception error

Open Amy-Li03 opened this issue 1 month ago • 0 comments

.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 Image

.NET framework project Image

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

  1. Create a WinForms .NET project
  2. Add a ToolStrip to form designer
  3. Add toolStripComboBox and toolStripProgressBar to ToolStrip control
  4. Ctrl + F5 to run this project
  5. Narrow down the width of form to make sure no toolstrip Item display on form designer
  6. Click on the ToolBar Options

Amy-Li03 avatar Dec 01 '25 07:12 Amy-Li03