.NET Framework Bookmark and Share   
 index > .NET Base Class Library > COM Interop Strange Behavior In IDE
 

COM Interop Strange Behavior In IDE

Currently, I am trying to expose some objects in a C# class library to COM so they can be used in a legacy VB6 app that could benefit from its functionality. It took some doing, but largely it has gone well.

However, I have run into something somewhat bizarre.

Understanding that generics cannot be directlyexposed to COM, I am attempting to expose a strongly typed collection derived from the System.Collections.ObjectModel.Collection<T> generic. When I compile, I get the following warning:

Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute.

Here's the weird part. I apply the ClassInterface(ClassInterfaceType.None) attribute to the class declaration for the target class to expose. In addition, I also place the ComDefaultInterface(typeof(type)) attribute to this class as well, giving thetype of the COM interface I've defined for this class. When I recompile the solution, the warning persists. Further recompilations crash the IDE!

Have I tripped over a bug here, or am I trying something that's really wrong?

Chuck S_

Hello All.

Chuck S. :

Yep, you really stepped in it. Check this link, although it may not be of much use.

Mark Benningfield

Hello All.

Chuck S. :

Yep, you really stepped in it. Check this link, although it may not be of much use.

Mark Benningfield

Thanks for the reply

Just in case there are any interested parties, I just D/L'd the VS2005 TE SP1 released a few days ago and it apparently it still isn't fixed.

Chuck S_

You can use google to search for other answers

Custom Search

More Threads

• ToString() parameters
• Problem in reading data from database using IDatareader
• DateTimePicker1 in tool bar
• Thead.Sleep()
• Printing Directly to Printer
• Can You Store Different Data Types In A ArrayList?
• plz i need help with my serial port
• Headache: A break change of .Net Framework2.0???
• Is there control which will fully emulate internet browser?
• Collection Best Practices