VS2013 Pro SP 4 Win 8.1 x64
I have two OleMenuCommands added to the Tools menu. I have given them a handler for the BeforeQueryStatus event.
I have added debugging code to the OnBeforeQueryStatus() that shows the handler is being called, and the correct text is being selected. However, the two menu items on the Tools menu are not correctly updated. Here's OnBeforeQueryStatus():
private void OnBeforeQueryStatus(object sender, EventArgs e) { DbgMessage("OnBeforeQueryStatus"); var myCommand = sender as OleMenuCommand; if (null != myCommand) { if (myCommand.CommandID.ID == (int)PkgCmdIdList.CmdIdCBAutoSave) { myCommand.Text = _autosaveEnabled ? "Disable Document AutoSave" : "Enable Document AutoSave"; DbgMessage(myCommand.Text); } if (myCommand.CommandID.ID == (int)PkgCmdIdList.CmdIdCBAutoSaveProject) { myCommand.Text = _autosaveProjectEnabled ? "Disable AutoSaveProject" : "Enable AutoSaveProject"; myCommand.Enabled = _autosaveEnabled; DbgMessage(myCommand.Text); } DbgMessage(string.Format("Id: {0} Text: {1}", myCommand.CommandID.ID, myCommand.Text)); } }
How can I diagnose what is going wrong? This doesn't seem to be an issue with VS2012/2013 running on Win7.
Another strange observation: When I debug the VSPackage (by starting devenv.exe with the /RootSuffix Exp argument), the menu items update as expected.