469,579 Members | 1,290 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

Problem Hiding Generic Implementation from Type Library Exporter

Hi All,

I'm trying to make an assembly in C# to use as a COM server. I'm building as
normal and ruinning regasm at the end. Everything is generally working,
except that I'm having a problem hiding some generic implementation base
classes from the type library exporter.

Here is a code sample:

-------------------------------------------------------

public interface IContainer
{
// imagine some stuff here
}

[ComVisibleAttribute(false)]
public class Container<T>
{
// imagine some stuff here
}

[ComDefaultInterfaceAttribute(typeof(IContainer))]
[ClassInterface(ClassInterfaceType.None)]
public class Test : Container<int>, IContainer
{
}

-----------------------------------------------------

This code compiles properly, but regasm gives this 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."

The class is skipped and not exported. What am I doing wrong here?

Aug 26 '05 #1
0 1153

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

49 posts views Thread by Steven Bethard | last post: by
11 posts views Thread by Lorenzo Villari | last post: by
13 posts views Thread by rkausch | last post: by
6 posts views Thread by Gaijinco | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.