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

VS2005: non CLS-compliant classes

I am currently in the process of upgrading my VB.NET applications and DLLs
from VS2003 to VS2005. Everything seems to be going fine, but I've had a
couple of warnings that I don't understand.

In one of my DLLs I define a MustInherit base class with various properties
and methods. In another DLL I inherit from that class to create a custom
derived class. I am getting the following warning in the IDE:

'DerivedClass' is not CLS-compliant because it derives from 'BaseClass',
which is not CLS-compliant.

No warnings are displayed at all for BaseClass. How can I determine what
exactly is it about BaseClass that stops it from being CLS-compliant?

For reference, I have Option strict On for the base class, and within its My
Project settings, I have all of the Compile Conditions set to either Error
or Warn except for "Use of variable prior to assignment" and
"Function/Operator without return value". Could it be one of these that is
causing the non-CLS-compliance issues to occur?

Many thanks,

--

(O)enone
Nov 21 '05 #1
3 7530
Not sure exactly what you're seeing. I tried the following as a test, and it
compiles without warning:

Public Class b
Inherits A

Public Overrides Sub foo()

End Sub
End Class

Public MustInherit Class A
Public MustOverride Sub foo()

End Class

"Oenone" wrote:
I am currently in the process of upgrading my VB.NET applications and DLLs
from VS2003 to VS2005. Everything seems to be going fine, but I've had a
couple of warnings that I don't understand.

In one of my DLLs I define a MustInherit base class with various properties
and methods. In another DLL I inherit from that class to create a custom
derived class. I am getting the following warning in the IDE:

'DerivedClass' is not CLS-compliant because it derives from 'BaseClass',
which is not CLS-compliant.

No warnings are displayed at all for BaseClass. How can I determine what
exactly is it about BaseClass that stops it from being CLS-compliant?

For reference, I have Option strict On for the base class, and within its My
Project settings, I have all of the Compile Conditions set to either Error
or Warn except for "Use of variable prior to assignment" and
"Function/Operator without return value". Could it be one of these that is
causing the non-CLS-compliance issues to occur?

Many thanks,

--

(O)enone

Nov 21 '05 #2
Oenone,
Do you have CLSCompliant attribute in your AssemblyInfo.vb file?

Is it set to True or False?

<Assembly: CLSCompliant(True)>

Do you have a CLSCompliant set to false on the base class?

I would expect a warning on the base class...

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Oenone" <oe****@nowhere.com> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
|I am currently in the process of upgrading my VB.NET applications and DLLs
| from VS2003 to VS2005. Everything seems to be going fine, but I've had a
| couple of warnings that I don't understand.
|
| In one of my DLLs I define a MustInherit base class with various
properties
| and methods. In another DLL I inherit from that class to create a custom
| derived class. I am getting the following warning in the IDE:
|
| 'DerivedClass' is not CLS-compliant because it derives from
'BaseClass',
| which is not CLS-compliant.
|
| No warnings are displayed at all for BaseClass. How can I determine what
| exactly is it about BaseClass that stops it from being CLS-compliant?
|
| For reference, I have Option strict On for the base class, and within its
My
| Project settings, I have all of the Compile Conditions set to either Error
| or Warn except for "Use of variable prior to assignment" and
| "Function/Operator without return value". Could it be one of these that is
| causing the non-CLS-compliance issues to occur?
|
| Many thanks,
|
| --
|
| (O)enone
|
|
Nov 21 '05 #3
Oenone,
Although VB 2002 & 2003 allowed you to include the CLSCompliant attribute it
didn't use the attribute, so the attribute was not included...

VB 2005 now uses the attribute & will report errors/warnings based on it. If
the attribute is missing, False is assumed.

http://msdn2.microsoft.com/en-us/library/ms182156.aspx
NOTE: You can include it on anything you want, not just an assembly.

http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx

For example I normally mark the assembly as CLSCompliant(True) while I may
make certain types or type members as CLSCompliant(False), such as members
that use non compliant COM interop classes... Due to Encapsulation exposing
non compliant COM interop classes is probably a bad idea anyway as it
increases coupling...

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Oenone" <oe****@nowhere.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
| Jay B. Harlow [MVP - Outlook] wrote:
| > Oenone,
| > Do you have CLSCompliant attribute in your AssemblyInfo.vb file?
|
| I didn't, but I added it to the AssemblyInfo for the project that provides
| the base class.
|
| It added another warning, telling me that one of the classes referred to a
| class in a referenced DLL that was also not CLSCompliant (though I have no
| idea why, it's a simple collection-style class that inherits from
| System.Collections.CollectionBase).
|
| I added the CLSCompliant attribute to that assembly too, and without any
| further changes, all the warnings have now gone away.
|
| Which is good, but means I still don't understand what the original issue
| is...
|
| Why is this attribute not applied to AssemblyInfo.vb by default?
|
| --
|
| (O)enone
|
|
Nov 23 '05 #4

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

Similar topics

2
by: David MacQuigg | last post by:
I think there is a documentation error in both the Library Reference section 2.1 and the Python 2.2 Quick Reference page 19. The explanation for this function is: super( type) Returns the...
25
by: BOOGIEMAN | last post by:
I've just finished reading Python turtorial for non-programmers and I haven't found there anything about some usefull commands I used in QBasic. First of all, what's Python command equivalent to...
1
by: shefali | last post by:
Hi, I have an aspx page with a web form. I need to change the page that this form posts to depending on certain conditions. To do so, I have Javascript code on the page that looks like: ...
1
by: Oscar Thornell | last post by:
Hi! I have a strongly typed dataset based on a db (SQL Server)... One of the tables contains a column with name: ISO-3166-A2 and data type nchar(2)... The generated code (xsd.exe) in the...
5
by: GaryDean | last post by:
(my original post was inaccurate but this post accurately describes what I think is a very bad vs2005 bug) short description... Deleting a dataset and recreating it from the dataadapter causes...
0
by: manoj.sahu | last post by:
hi all, as per my study CLS is the common set of specification which should by meet by the language which want to target CLS(or .net). and CTS is the set of common types(or common data types)...
22
by: mp | last post by:
i have a python program which attempts to call 'cls' but fails: sh: line 1: cls: command not found i tried creating an alias from cls to clear in .profile, .cshrc, and /etc/profile, but none...
1
by: Smokey Grindle | last post by:
Is there a good explination of what would cause a CLS warrning in .NET 2.0 out there anywhere? like list of reasons and examples of what cause an object or type to not be CLS complaint? thanks!
3
by: james_027 | last post by:
hi, is cls & self the same thing? I have seen something like class A: def dosomething(cls): #doing something
9
AmberJain
by: AmberJain | last post by:
Hello, What is the difference between --------> 1. clrscr(); // defined in various header files 2. system("cls"); //available in stdio.h in bloodshed dev c++ Well,...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
1
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
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...
0
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,...
0
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.