Skip to content

Application Crash and Menu Not Added in ToolStrip when Using ToolStripControlHost with a Custom UserControl #13132

Open

Description

@Sekar47

Environment

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.

TabControl_VB.zip

Recording 2025-03-13 165846.zip

Diagnostics


Activity

  1. added
    untriaged
    on Mar 13, 2025
  2. Olina-Zhang commented on Mar 14, 2025

    @Olina-Zhang
    Member
  3. added
    area-VSDesigner
    on Mar 19, 2025
  4. added this to the VS release milestone on Mar 19, 2025
  5. removed
    untriaged
    on Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-VSDesigner

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions