473,480 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3556
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
2030
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
4167
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
1393
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
1762
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
2002
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
566
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
11103
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
10057
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
2739
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
6912
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
7052
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,...
1
6744
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
565
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.