473,320 Members | 1,961 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,320 software developers and data experts.

Hide warning: "Generic classes may not be exposed to COM"

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\Mic rosoft.Common.targets :
warning : Type library exporter warning processing 'Utility.Array1D`1,
Test2003'. Warning: Type library exporter encountered a generic type.
Generic classes may not be exposed to COM."

Is there a way to hide these warnings?

Torben
Mar 1 '07 #1
5 11084
On Thu, 1 Mar 2007 14:14:37 +0100, "Torben Laursen" <To****@newsgroups.nospam>
wrote:
>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\Mi crosoft.Common.targets :
warning : Type library exporter warning processing 'Utility.Array1D`1,
Test2003'. Warning: Type library exporter encountered a generic type.
Generic classes may not be exposed to COM."

Is there a way to hide these warnings?

Torben
In your project properties open the Build Tab and either set the warning level
to something that will prevent the level of warnings you don't want to see, or
enter the warning number in the Suppress Warnings text box. Browse help for a
complete explanation of the Build Tab.

Do the above at your own risk....
Good luck with your project,

Otis Mukinfus

http://www.otismukinfus.com
http://www.arltex.com
http://www.tomchilders.com
http://www.n5ge.com
Mar 1 '07 #2
"Otis Mukinfus" <ph******************@phoney.comwrote in message
news:jp********************************@4ax.com...
On Thu, 1 Mar 2007 14:14:37 +0100, "Torben Laursen"
<To****@newsgroups.nospam>
wrote:
>>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\M icrosoft.Common.targets :
warning : Type library exporter warning processing 'Utility.Array1D`1,
Test2003'. Warning: Type library exporter encountered a generic type.
Generic classes may not be exposed to COM."

Is there a way to hide these warnings?

Torben
In your project properties open the Build Tab and either set the warning
level
to something that will prevent the level of warnings you don't want to
see, or
enter the warning number in the Suppress Warnings text box. Browse help
for a
complete explanation of the Build Tab.

Do the above at your own risk....
Good luck with your project,

Otis Mukinfus
Otis,

Thanks.

The warning that I get does not seems to have a number, or in the output
from the compiler it does not give one.

I could lower the warning level but I am a big fan of keeping it high.

Torben
Mar 1 '07 #3
Hi,

How did you mark your generic class?

What if you make them private or internal ?
--
Ignacio Machin
machin AT laceupsolutions com

"Torben Laursen" <To****@newsgroups.nospamwrote in message
news:O2*************@TK2MSFTNGP06.phx.gbl...
>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\Mic rosoft.Common.targets :
warning : Type library exporter warning processing 'Utility.Array1D`1,
Test2003'. Warning: Type library exporter encountered a generic type.
Generic classes may not be exposed to COM."

Is there a way to hide these warnings?

Torben

Mar 1 '07 #4
Ignacio,

The generic class is a small utility class that I use in bigger classes that
are public members of a C# dll.
It is maked as public.

If I mark the generic class as private I get a compiler error:
Namespace elements cannot be explicitly declared as private, protected, or
protected internal

I have not tryed to move the generic glass outside the namespace since I
prefere to keep all my code inside namespace's
If I mark the generic class as internal I get a large number of compiler
errors:
Inconsistent accessibility: field type 'Utility.Array1D<double>' is less
accessible than field 'BookKeeping.Phases_Base.Composition'

Torben

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%2***************@TK2MSFTNGP06.phx.gbl...
Hi,

How did you mark your generic class?

What if you make them private or internal ?
--
Ignacio Machin
machin AT laceupsolutions com

"Torben Laursen" <To****@newsgroups.nospamwrote in message
news:O2*************@TK2MSFTNGP06.phx.gbl...
>>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\Mi crosoft.Common.targets :
warning : Type library exporter warning processing 'Utility.Array1D`1,
Test2003'. Warning: Type library exporter encountered a generic type.
Generic classes may not be exposed to COM."

Is there a way to hide these warnings?

Torben


Mar 1 '07 #5
Torben,
>Is there a way to hide these warnings?
Make sure you have the ComVisible(false) attribute at the assembly
level (for example in AssemblyInfo.cs), and then explcitly mark the
types you want to export to COM with ComVisible(true).
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Mar 1 '07 #6

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

Similar topics

3
by: TheLetti | last post by:
Hy! I've just downloaded the latest Java 2 SDK (j2sdk1.4.2_01). For my surprise in this version the servlet-classes are not integrated (e.g. the class javax.servlet). So I found all the...
1
by: Vicente Nicolau | last post by:
hello, I have a problem when I preview or print a document in an ISO A0. I have an application which load an 10x10 image (bmp or jpg) and spread it in the A0 paper. When I make the print...
24
by: Alf P. Steinbach | last post by:
The eighth chapter (chapter 2.1) of my attempted Correct C++ tutorial is now available, although for now only in Word format -- comments welcome! Use the free & system-independent Open Office...
9
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. ...
2
by: Jon Davis | last post by:
The garbage handler in the .NET framework is handy. When objects fall out of scope, they are automatically destroyed, and the programmer doesn't have to worry about deallocating the memory space...
3
by: Giggle Girl | last post by:
I have inherited some CSS from a former employee that has code like this: onmouseover="this.className='highlight_on standard_border'" where it appears to activate two different classes,...
2
by: morangolds | last post by:
Hi all, I work as a glue coder and often have to interface existing mechanisms with other platforms. Creating bridge code between command-line functionality and desktop GUIs takes up a lot of that...
2
by: JB | last post by:
Hi All, I'm pulling my hair over this and could really do with a bit of help. I'm using various different enums as bit fields and I'd like to create a set of generic Functions or Subs to...
4
by: Peter K | last post by:
Hi if I am developing a "class library" which contains some classes which should be exposed to the outside world, and other classes which I really would rather have "private" to my library...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.