11 Replies Latest reply on Oct 16, 2017 4:45 PM by Amen Allah Jlili

    Debug issue with context menu

    Amen Allah Jlili

      I'm having this weird issue with context menus.


      You can put this snippet in the ConnectToSW method


               swCommandManager = (CommandManager)SOLIDWORKSApplication.GetCommandManager(Cookie);

      var CommandGroup = swCommandManager.AddContextMenu(15, "MyAddin") as CommandGroup;

                  var commandID = CommandGroup.AddCommandItem2("Edit", 0, "Edit", "Edit", -1, "Edit", "", 0, (int)swCommandItemType_e.swToolbarItem);

                  CommandGroup.SelectType = (int)swSelectType_e.swSelCOMPONENTS;

                  CommandGroup.ShowInDocumentType = (int)swDocTemplateTypes_e.swDocTemplateTypeASSEMBLY;

                  CommandGroup.HasToolbar = false;

                  CommandGroup.HasMenu = false;



      The debugger seems to hit the Activate() line and then abruptly exit the debug mode. SOLIDWORKS 2017 seems also to crash.

      Has anyone seen this behavior before. Thanks!