Visual Studio and .NET Framework Home
CommandBarButton.TooltipText causes exceptions when getting or setting its value
Carlos J. Quintero
5/28/2009 5:06:04 AM
User(s) can reproduce this bug
When an add-in creates a CommandBarButton and tries to get or set its TooltipText property, an exception is thrown.
Visual Studio 2010 Beta 1
Windows XP Professional
Operating System Language
Steps to Reproduce
Microsoft Visual Studio 2010 Version 10.0.20506.1 Beta1
Microsoft .NET Framework Version 4.0
Installed Version: Enterprise
Create an add-in that creates a command using EnvDTE.DTE.Commands.AddNamedCommand and a CommandbarButton using EnvDTE.Command.AddControl.
Note: I am using VS 2005 and .NET 2.0 to create an add-in that targets VS 2005, VS 2008 and VS 2010, but I guess that the problem should reproduce with an add-in created with VS 2010 and .NET 4.0
- When you try to get the CommandBarButton.TooltipText property you get:
System.ArgumentException: "Value does not fall within the expected range."}
- When you try set its value you get:
System.ArgumentNullException: "Value cannot be null". Parameter name: obj"}
The property should work. Although you can set the tooltip of a CommandbarButton when creating its command (in the AddNamedCommand call), you may want to change it after the CommandbarButton is created because of two causes:
1) You want to change its value depending on the context (after the button was created)
2) VS 2005 didn't honor the tooltip set when creating the command (it used the caption instead), a bug that was fixed in VS 2008. So, as a workaround add-ins targeting several IDEs may have code that calls CommandBarButton.TooltipText for all IDEs (not only for VS 2005), even when it is not neeeded and this exception will break them (this is my case).
TAP Code (if applicable)
You can indicate your satisfaction with how Microsoft handled this issue by completing this quick
3 question survey
to post a comment.
Please enter a comment.
on 6/17/2009 at 5:28 PM
Hello MVP CarlosQ,
Thank you for letting us know about the exception that was being thrown when an add-in creates a CommandBarButton and tries to get or set its TooltipText property – as you assumed, this was something that we needed to address for Visual Studio 2010.
A developer on our team has investigated this, and has made a fix that should resolve this in future releases of Visual Studio 2010. This bug is now in the process of being signed off on by our QA team. Thanks again for taking the time to report the issue.
Suzanne Hansen, Program Manager, Visual Studio Platform Shell Team
on 5/31/2009 at 1:05 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.
Visual Studio Product Team
to post a workaround.
Please enter a workaround.
© 2014 Microsoft