Home Dashboard Directory Help

Problems with ContextUIGUIDs and vsCommandDisabledFlagsValue in EnvDTE.Commands.AddNamedCommand by Carlos J. Quintero


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 466691
Opened: 6/12/2009 12:48:17 PM
Access Restriction: Public
User(s) can reproduce this bug


This is the issue #276732 opened again since it was closed as "Won't fix" for VS 2008 due to lack of time:


Maybe you can fix it for VS 2010.


The EnvDTE.Commands.AddNamedCommand method does not honor ContextUIGUIDs and vsCommandDisabledFlagsValue. In fact, it does it in the reverse way. First, see the MSDN docs:


As the documentation states, if the add-in is not loaded, the ContextUIGUIDs and vsCommandDisabledFlagsValue parameters are used to know the state of the command (once loaded, the QueryStatus method will be used instead). If a ContextUIGUIDs is used and it is active, then the command should be enabled. If it is not active, then the command could be disabled or invisible and the programmer can specify it using the vsCommandDisabledFlagsValue. We will see that the AddNamedCommand does not behave as documented.
Sign in to post a comment.
Posted by Microsoft on 11/3/2009 at 9:50 AM
Hi Carlos,

I wanted to let you know that we determined that this was a documentation bug. Commands.AddNamedCommand (C.A for brevity), Commands2.AddNamedCommand (C2.A), and Commands2.AddNamedCommand2 (C2.A2) will need to be updated. I am sending this bug on to the documentation team to make the changes listed below. The following links are for reference to each of these commands:

C.A.: http://msdn.microsoft.com/en-us/library/envdte.commands.addnamedcommand(VS.80).aspx
C2.A: http://msdn.microsoft.com/en-us/library/ead5absh(VS.80).aspx
C2.A2: http://msdn.microsoft.com/en-us/library/envdte80.commands2.addnamedcommand2(VS.80).aspx

Updates that were identified:
1)    The vsCommandDisabledFlagsValue parameter for C.A and C2.A should be named vsCommandStatusValue. C2.A2 has this right.
2)    The description for ContextUIGUIDs in all three reads "A SafeArray of GUIDs that determines which environment contexts (that is, debug mode, design mode, and so on) enable the command." "Enable" should be "show."
3)    The description for vsCommandStatusValue should read something like “Controls the enabled state of the command when it is shown.”
4)    The Remarks section appears only in C.A and C2.A. It should appear in C2.A2 as well.
5)    The Remarks section need to be updated to refer to the parameter ContextUIGUIDs instead of ppsaContextUIGUIDs.
6)    The Remarks section says “The ppsaContextUIGUIDs parameter is used when the Add-in is not loaded and thus cannot respond to the QueryStatus method” It should indicate the same for the vsCommandStatusValue parameter. With the change mentioned in #5, the update should result in something like: “The ContextUIGUIDs and the vsCommandStatusValue parameters are used when the Add-in is not loaded and thus cannot respond to the QueryStatus method.”

Please let me know if you have any comments or concerns regarding these identified documentation issues.

Suzanne Hansen, Program Manager, Visual Studio Platform Shell Team
Posted by Microsoft on 7/1/2009 at 5:02 PM
Thanks for the feedback. We are currently investigating this issue and will get back to you shortly.

Visual Studio Platform Team
Posted by Microsoft on 6/15/2009 at 3:12 AM
Thanks for your feedback.

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.
These specialized experts will follow-up with your issue.
Sign in to post a workaround.