I'm rather stuck with a problem I found while attempting to port a package from visual studio 2008 to 2010 and wondered if anyone would have any ideas please note this worked in visual studio 2008 and I am unsure why it doesn't work in 2010,
the offending piece of code is here:
IVsUIShell uiShell = (IVsUIShell)TestPackage.GetGlobalService(typeof (SVsUIShell));
Guid context = GuidList.GUIDTestMarkerCmdSet;
POINTS[] menuPos = new POINTS[1];
menuPos[0].x = (short)Cursor.Position.X;
menuPos[0].y = (short)Cursor.Position.Y;
var hr = uiShell.ShowContextMenu(0, ref context,(int)PkgCmdIDList.ContextMenu, menuPos, this); //access violation happens here.
if (hr != VSConstants.S_OK)
return VSConstants.S_FALSE;
break;
uiShell context is a vaild com pointer as far as I can tell and I can call other methods on it without it blowing up.
I think It has to do with the context menu setup in the xml vsct file. relevent parts of which can be seen below.
<Groups>
<Group guid="guidTestMarkerCmdSet" id="ContextGroup" priority="0x100" >
<Parent guid="guidTestMarkerCmdSet" id="ContextMenu"/>
</Group>
</Groups>
<Menus>
<Menu guid="guidTestMarkerCmdSet" id="ContextMenu" type="Context">
<Parent guid="guidTestMarkerCmdSet" id="0"/>
<Strings>
<ButtonText>Test Runner Context Menu</ButtonText>
<CommandName>TestRunnerContextMenu</CommandName>
</Strings>
</Menu>
</Menus>
<Buttons>
<Button guid="guidTestMarkerCmdSet" id="cmdRunTest" priority="0x1" type="Button">
<Parent guid="guidTestMarkerCmdSet" id="ContextGroup"/>
<Strings>
<ButtonText>Run Test</ButtonText>
<CommandName>cmdRunTest</CommandName>
</Strings>
</Button>
<Button guid="guidTestMarkerCmdSet" id="cmdDebugTest" priority="0x1" type="Button">
<Parent guid="guidTestMarkerCmdSet" id="ContextGroup"/>
<Strings>
<ButtonText>Debug Test</ButtonText>
<CommandName>cmdDebugTest</CommandName>
</Strings>
</Button>
any help would be much appeciated, I'm rather mythed atm
Thank you