You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Application Crash and Menu Not Added in ToolStrip when Using ToolStripControlHost with a Custom UserControl #13132
Edition - Windows 11 Enterprise
Version - 23H2
OS build - 22631.3737
Visual Studio version - 17.12.2
.NET version
NET90
Did this work in a previous version of Visual Studio and/or previous .NET release?
No
Issue description
Requirement:
I need to create a custom dropdown menu as a UserControl. The goal is to use this custom menu in various ToolStrip controls across different TabPages within a TabControl.
Issue Faced:
While implementing this feature, I encountered two critical issues:
1.Menu Not Added to ToolStrip:
Despite correctly adding the custom menu UserControl to the ToolStrip via ToolStripControlHost, the menu does not appear as expected. The ToolStripControlHost is not rendering the menu inside the ToolStrip control.
2.Application Crash:
In addition to the above, when trying to add the custom UserControl to the ToolStrip, the application crashes. This occurs specifically when using ToolStripControlHost to host the UserControl.
Steps to reproduce
1.Create a new Windows Forms project.
2.Add a TabControl with multiple TabPages in the form
3.Create a UserControl (Menu) that contains a ToolStrip with a ToolStripDropDownButton and a few ToolStripMenuItems.
4.In the Form1 designer, use ToolStripControlHost to host the Menu UserControl and add it to the ToolStrip in TabPage1.
5.Run the application.
6.The menu should appear in the ToolStrip, but an application crash occurs when trying to close and reopen the design files.
Activity
Olina-Zhang commentedon Mar 14, 2025
Similar one: #4336, we have an internal designer issue to track: https://github.com/microsoft/winforms-designer/issues/2632.