Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2006

Tip: Looking for answers? Try searching our database.

Not CLS-compliant

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin Burton - 28 Jun 2006 16:09 GMT
I have an argument in the constructor for a VB form that as a parameter that
looks like:

ByVal lblHeader As Controls.MGLabel

Visual Studio 2005 gives me a warning:

Type of parameter 'lblHeader' is not CLS-compliant

I am not sure what to do.

Thank you.

Kevin
William Sullivan - 29 Jun 2006 16:38 GMT
I wouldn't worry about it.  This warning is telling you that, if you use this
type, your code will not be CLS compliant.  CLS being the Common Language
Specification, which dictates what language features must be supported in
every .NET language.  Not being CLS compliant means that, if you release your
code as a reusable library, a consumer writing in a different .NET language
(like C#, or IronPython, or even Cobol.NET) may have problems using your DLL.
If you don't care about this, then the warning can safely be ignored.  You
can mark your assembly with an attribute to turn off the error.  Do a search
for CLSCompliantAttribute for more info.

> I have an argument in the constructor for a VB form that as a parameter that
> looks like:
[quoted text clipped - 10 lines]
>
> Kevin
Kevin Burton - 30 Jun 2006 06:35 GMT
From the information that I have given can you tell what is "non-compliant"
about the parameter?

> I wouldn't worry about it.  This warning is telling you that, if you use this
> type, your code will not be CLS compliant.  CLS being the Common Language
[quoted text clipped - 20 lines]
> >
> > Kevin
William Sullivan - 30 Jun 2006 14:43 GMT
Well, the problem is that I have no idea what a MGLabel is.  If you created
that class yourself, it may contain a public variable or parameter or a
public method that has a parameter or return type that is non-CLS compliant.  
Or, the type itself (if you bought the control from a company) may be marked
with the attribute CLSCompliant(false).  Hard to say.  If you can post the
code for the control here, I could take a look at it.  Or, if someone else
designed the control and it's a .NET control, you can use Lutz Roeder's
Reflector to view the code for the control and see what's going on in there.  

The main thing to take away from this is that CLS compliance doesn't really
matter unless you are exposing a type that is not CLS compliant in a reusable
code library that you are selling or giving to other .NET developers.  If you
are using it internally, just mark the assembly that contains the
non-compliant code with the attribute CLSCompliant(false) and you'll never
have to see that message again.

> From the information that I have given can you tell what is "non-compliant"
> about the parameter?
[quoted text clipped - 23 lines]
> > >
> > > Kevin

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.