Home Dashboard Directory Help

"Object must be the same type as the enum" exception calling CommandBars.Add from an add-in by Carlos J. Quintero


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 462766
Opened: 6/1/2009 7:41:41 AM
Access Restriction: Public
User(s) can reproduce this bug


When you create an add-in with the wizard and make this call:

toolBar = commandBars.Add(Name:="My toolbar", Position:=Microsoft.VisualStudio.CommandBars.MsoBarPosition.msoBarTop, Temporary:=True)

you get the exception:

"Object must be the same type as the enum. The type passed in was 'Microsoft.VisualStudio.CommandBars.MsoBarPosition'; the enum type was 'Microsoft.VisualStudio.CommandBars.MsoBarPosition'."
Sign in to post a comment.
Posted by Microsoft on 10/23/2009 at 7:18 PM
Many thanks for reporting this issue. It will be fixed in .NET Framework 4.0 RC/RTM releases.

Ladi Prosek, CLR team
Posted by Microsoft on 6/2/2009 at 11:21 PM
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.

Thank you,
Visual Studio Product Team
Sign in to post a workaround.
Posted by karl140.6 on 10/18/2009 at 12:06 PM
For Visual Studio 2010 Beta releases you must do the following:

Set the Microsoft Visual Studio Command Bars 8.0 reference property, "Embed Interop Types" to false.

Simple click on the reference to the above .dll, in the properties window change "Embed Interop Types" to false.