AnsweredAssumed Answered

Debug issue with context menu

Question asked by Amen Allah Jlili on Oct 11, 2017
Latest reply on Oct 16, 2017 by 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;

            CommandGroup.Activate();

 

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!

Outcomes