473,395 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problems 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
1 3553
Sorry for the duplicate entry, Tom

"Tom Z." wrote:
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 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Janus Kamp Hansen | last post by:
I have had this error: 'COM Interop registration failed. Type library exporter can not load required library MSCOREE.TLB.' I have found a solution, by using the Regmon tool...
11
by: Lorenzo Villari | last post by:
I premise I don't know C++ well but... I wondered what is this data hiding thing... I mean, if I can look at the header (and i need it beacuse of the class), then what's hidden? Can someone give...
0
by: Tom Z. | last post by:
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...
0
by: Mike P. | last post by:
Hi all, I'm working on a simulation (can be considered a game) in Python where I want to be able to dump the simulation state to a file and be able to load it up later. I have used the standard...
0
by: Richard Taylor | last post by:
User-Agent: OSXnews 2.07 Xref: number1.nntp.dca.giganews.com comp.lang.python:437315 Hi I am trying to use py2app (http://undefined.org/python/) to package a gnome-python application...
1
by: Tom Z. | last post by:
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...
5
by: Torben Laursen | last post by:
I am writing a COM in C# using visual studio 2005 and VSTO. Inside the code I use some support classes that are generic but they are not used in the inferface of the COM. However I still get a...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
27
by: matt | last post by:
Hello group, I'm trying to become familiar with the information hiding design rules, and I have a lot (3) of questions for all you experts. AFAIK, a generic module has 2 files: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.