Home Dashboard Directory Help
Search

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


Status: 

Closed
 as Fixed Help for as Fixed


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

Description

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'."
Details
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.

Thanks!
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.