473,545 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ 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
}

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

[ComDefaultInter faceAttribute(t ypeof(IContaine r))]
[ClassInterface( ClassInterfaceT ype.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( ClassInterfaceT ype.None)].
Class interfaces cannot be exposed for such types. Consider marking the type
with [ClassInterface( ClassInterfaceT ype.None)] and exposing an explicit
interface as the default interface to COM using the ComDefaultInter face
attribute."

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

Aug 26 '05 #1
1 3566
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
}

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

[ComDefaultInter faceAttribute(t ypeof(IContaine r))]
[ClassInterface( ClassInterfaceT ype.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( ClassInterfaceT ype.None)].
Class interfaces cannot be exposed for such types. Consider marking the type
with [ClassInterface( ClassInterfaceT ype.None)] and exposing an explicit
interface as the default interface to COM using the ComDefaultInter face
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
2046
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 (http://www.sysinternals.com/Utilities/Regmon.html) - "Extremly cool tool", I might say. If you remove these keys from you registration database, it might be working...
11
4170
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 me an example of something hidden from the user?
0
1403
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 hiding some generic implementation base classes from the type library exporter. Here is a code sample: ...
0
1771
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 Python pickle module and it works fine pickling/unpickling from files. However, I want to be able to use a third party tool like an XML editor (or...
0
2010
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 called gramps (http://www.gramps-project.org) for MAC OS X.
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 hiding some generic implementation base classes from the type library exporter. Here is a code sample: ...
5
11111
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 number of warnings from the compiler like: "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning : Type library exporter...
162
10104
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 prefix them with 2 underscores, but I hate prefixing my vars, I'd rather add a keyword before it. Python advertises himself as a full OOP language,...
27
2748
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: ================ module.h ================ #ifndef __MODULE_HDR_INCLUDED__
0
7682
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7935
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7449
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7780
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6009
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5069
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1911
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 we have to send another system
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
734
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.