VS 2010 is changing the commandbars from the COM-based ones borrowed from Office to new WPF (.NET) ones, and the Beta 1 is the first public release showing this. The change is still under construction. For example, the “Tools”, “Customize…” menu is disabled for Beta 1 and you can’t change by hand (you can programmatically) a toolbar location from the top to the bottom, or to the left/right or make it floating as in previous versions. I am not sure if this is “by design” or a “not implemented yet” feature.
There are good news and bad news regarding the new CommandBar implementation.
The good news are that:
– Finally we may get rid of obscure COMExceptions that happened from time to time in the old implementation that I reported here, here and here.
– The object model is the same to to preserve compatibility with existing add-ins.
The bad news are:
– The object model is the same, confusing one, with lots of optional parameters, Object-typed parameters and so on. This is to preserve compatibility with existing add-ins, but there is not a new more clear model with strongly typed parameters and more intuitive. You can learn the model here: HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in
– The object model is not 100% backwards at run-time, some properties cause a “deprecated exception”. Not a big deal, but something to take into account.
– The new model still requires a satellite DLL and doesn’t accept icons yet to support transparency on custom buttons more easily, and guess what, you can’t get transparent buttons on Beta 1 (at least using a native resource dll, I have to test with a managed satellite DLL). I am strongly discussing this with Microsoft to see if they can fix this problem for good.
– There are quite a few bugs yet (some others that I reported were fixed for Beta 1). My list of known bugs is the following one, just in case you want to be aware of them or want to vote to get them fixed:
These ones are already acknowledged and will be fixed in the next build:
CommandBarButtons created by add-ins in context menus don’t appear
CommandBarPopup on toolbars doesn’t show arrow to indicate the dropdown
These ones are being investigated at the time of this writing:
Custom pictures in CommandBarButtons created by add-in don’t show a transparent background
System.ArgumentNullException: “Value cannot be null.” getting CommandBar.Position from an add-in
“Object must be the same type as the enum” exception calling CommandBars.Add from an add-in
CommandBars.Item(“Tools”) causes exception rather than finding the commandbar.
CommandBarButton.TooltipText causes exceptions when getting or setting its value
Hopefully we can get them fixed, I have spent a lot of time this week isolating them to the minimal expression (my MZ-Tools add-in has a complex architecture to handle commands and buttons).
I was just thinking, has anybody else spotted problems with the Beta1 VS2010 command bars issue and about to publish some code to the Community Connection site. But you may have already done that.
In addition, which I have yet to publish (working in C++)
1. Creating dynamic tool windows with an add-in fails.
2. Adding a submenu to an existing menu (eg. Tools) returns E_INVALIDARG, but doesn’t in VS2008.
3. Returning the main window in DTE returns NULL in C++, C# but not in scripting. This one has been escalated (hoping for the next build).