This class is coming up as not CLS compliant, why?
with this warrning
Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty
Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace 11 1424
I believe "as Int64" is the culprit
to prove/disprove, change it temporarily to Integer
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
This class is coming up as not CLS compliant, why?
with this warrning
Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty
Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
nope, didnt change anything, I thought just unsigned integers, and unsigned
values where non-CLS
"gs" <gs@dontMail.teluswrote in message
news:em**************@TK2MSFTNGP02.phx.gbl...
>I believe "as Int64" is the culprit
to prove/disprove, change it temporarily to Integer
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
>This class is coming up as not CLS compliant, why? with this warrning Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
The only errors I get in a VB 2005 console application for this code is
Warning 1 Only one XML comment block is allowed per language element.
C:\Documents and Settings\mdo\Local Settings\Application Data\Temporary
Projects\ConsoleApplication1\Module1.vb 11 5 ConsoleApplication1
I get this error on the ''' <summary>, ''' Represents and account, and '''
</summarylines
Mike.
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
This class is coming up as not CLS compliant, why?
with this warrning
Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty
Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
Shouldn't be any errors there, thats a valid XML comment block
"Michael D. Ober" <obermd.@.alum.mit.edu.nospamwrote in message
news:uT**************@TK2MSFTNGP05.phx.gbl...
The only errors I get in a VB 2005 console application for this code is
Warning 1 Only one XML comment block is allowed per language element.
C:\Documents and Settings\mdo\Local Settings\Application Data\Temporary
Projects\ConsoleApplication1\Module1.vb 11 5 ConsoleApplication1
I get this error on the ''' <summary>, ''' Represents and account, and '''
</summarylines
Mike.
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
>This class is coming up as not CLS compliant, why? with this warrning Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
Works just fine for me. I'm not getting any warnings in .NET 2005
/claes
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
This class is coming up as not CLS compliant, why?
with this warrning
Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty
Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
You need to remove the blank lines in between them.
/claes
"Michael D. Ober" <obermd.@.alum.mit.edu.nospamwrote in message
news:uT**************@TK2MSFTNGP05.phx.gbl...
The only errors I get in a VB 2005 console application for this code is
Warning 1 Only one XML comment block is allowed per language element.
C:\Documents and Settings\mdo\Local Settings\Application Data\Temporary
Projects\ConsoleApplication1\Module1.vb 11 5 ConsoleApplication1
I get this error on the ''' <summary>, ''' Represents and account, and '''
</summarylines
Mike.
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
>This class is coming up as not CLS compliant, why? with this warrning Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
wierd its still throwing a CLS warrning to this day for me
"Claes Bergefall" <lo*****@nospam.nospamwrote in message
news:Op**************@TK2MSFTNGP05.phx.gbl...
Works just fine for me. I'm not getting any warnings in .NET 2005
/claes
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
>This class is coming up as not CLS compliant, why? with this warrning Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
There isn't any reason why this code as presented here shouldn't be
considered CLS compliant. I gather you are using Visual Studio for
this. Have you tried compiling from a command line?
Ralf
"Smokey Grindel" <no****@nospam.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
: wierd its still throwing a CLS warrning to this day for me
:
: "Claes Bergefall" <lo*****@nospam.nospamwrote in message
: news:Op**************@TK2MSFTNGP05.phx.gbl...
: Works just fine for me. I'm not getting any warnings in .NET 2005
: >
: /claes
: >
: "Smokey Grindle" <no****@dontspamme.comwrote in message
: news:Or**************@TK2MSFTNGP04.phx.gbl...
: >This class is coming up as not CLS compliant, why?
: >with this warrning
: >Warning 2 Type 'Account' is not CLS-compliant.
: >>
: >Namespace Accounts
: >>
: >''' <summary>
: >>
: >''' Represents an account
: >>
: >''' </summary>
: >>
: >''' <remarks></remarks>
: >>
: >Public Class Account
: >>
: >Private m_AccountID As Int64
: >>
: >Private m_Name As String = String.Empty
: >>
: >>
: >>
: >Public Property AccountID() As Int64
: >>
: >Get
: >>
: >Return m_AccountID
: >>
: >End Get
: >>
: >Set(ByVal value As Int64)
: >>
: >m_AccountID = value
: >>
: >End Set
: >>
: >End Property
: >>
: >Public Property Name() As String
: >>
: >Get
: >>
: >Return m_Name.Trim
: >>
: >End Get
: >>
: >Set(ByVal value As String)
: >>
: >m_Name = value
: >>
: >End Set
: >>
: >End Property
: >>
: >Public Sub New()
: >>
: >Me.AccountID = -1
: >>
: >Me.Name = String.Empty
: >>
: >End Sub
: >>
: >Public Sub New(ByVal accountID As Int64, ByVal name As String)
: >>
: >Me.AccountID = accountID
: >>
: >Me.Name = name.Trim
: >>
: >End Sub
: >>
: >Public Overrides Function ToString() As String
: >>
: >Return Me.Name
: >>
: >End Function
: >>
: >End Class
: >>
: >End Namespace
: >>
: >>
: >
: >
:
:
Thanks - I hadn't used the XML comment creation in VB so I wasn't aware that
the all had to be consecutive lines.
Mike.
"Claes Bergefall" <lo*****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
You need to remove the blank lines in between them.
/claes
"Michael D. Ober" <obermd.@.alum.mit.edu.nospamwrote in message
news:uT**************@TK2MSFTNGP05.phx.gbl...
The only errors I get in a VB 2005 console application for this code is
Warning 1 Only one XML comment block is allowed per language element.
C:\Documents and Settings\mdo\Local Settings\Application Data\Temporary
Projects\ConsoleApplication1\Module1.vb 11 5 ConsoleApplication1
I get this error on the ''' <summary>, ''' Represents and account, and
'''
</summarylines
Mike.
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
This class is coming up as not CLS compliant, why?
with this warrning
Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty
Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
Cut and paste your code into a new project. Something's wrong in how the
compiler is interpreting your code. I just had to do a similar move in a C#
catch block.
Mike Ober.
"Smokey Grindel" <no****@nospam.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
wierd its still throwing a CLS warrning to this day for me
"Claes Bergefall" <lo*****@nospam.nospamwrote in message
news:Op**************@TK2MSFTNGP05.phx.gbl...
Works just fine for me. I'm not getting any warnings in .NET 2005
/claes
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
This class is coming up as not CLS compliant, why?
with this warrning
Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty
Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
Smokey,
In addition to the other comments:
Is this the only class that is, or do you have other classes that are not
CLS compliant?
Do you have CLSComplaint(False) at the assembly level? For example the
following line in any files in the project:
<Assembly: CLSCompliant(False)>
As the others have stated, using your code as posted I do not receive a
warning.
--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Smokey Grindle" <no****@dontspamme.comwrote in message
news:Or**************@TK2MSFTNGP04.phx.gbl...
This class is coming up as not CLS compliant, why?
with this warrning
Warning 2 Type 'Account' is not CLS-compliant.
Namespace Accounts
''' <summary>
''' Represents an account
''' </summary>
''' <remarks></remarks>
Public Class Account
Private m_AccountID As Int64
Private m_Name As String = String.Empty
Public Property AccountID() As Int64
Get
Return m_AccountID
End Get
Set(ByVal value As Int64)
m_AccountID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name.Trim
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
Me.AccountID = -1
Me.Name = String.Empty
End Sub
Public Sub New(ByVal accountID As Int64, ByVal name As String)
Me.AccountID = accountID
Me.Name = name.Trim
End Sub
Public Overrides Function ToString() As String
Return Me.Name
End Function
End Class
End Namespace
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Edward Diener |
last post by:
Does anyone know the correct naming conventions for CLS compliant code ?
The doc points to a really obscure and difficult to digest document on
the web about Unicode names, and I am looking for...
|
by: Pieter |
last post by:
Hi,
I have this Warning for several forms when using the DockPanel Suite of
Weifen Luo in VS.NET 2005. I read a lot about this CLS-compliant stuff, but
I don't now how to chech actually which...
|
by: fm |
last post by:
We would like to consider using ASP.NET for our portal development. A
requirement is that the pages are 508 compliant.
http://www.section508.gov/index.cfm?FuseAction=Content&ID=3
All I have been...
|
by: Rob R. Ainscough |
last post by:
When I use the DataSet wizard to create an .xsd I get a "...is not
CLS-compliant" warning -- now this is code generated by VS 2005 (aka
Microsoft) -- why would it generate none compliant code??
...
|
by: moondaddy |
last post by:
I converted a vb.1.1 web service project to 2.0 and .net 2.0 created /
replace some datasets. The code it automatiacly generated gets a warning
message as follows:
Warning 150 Name...
|
by: nicdude |
last post by:
There is a Comeau C++ compiler special offer at
http://www.comeaucomputing.com Is it really as compliant as it seems
to imply? In terms of Standard C++, what is it missing? Can it
handle...
|
by: Slindee |
last post by:
I am getting a warning message:
Type of parameter 'nodParent' is not CLS-compliant
on the following statement. Anything I can do to satisfy the warning?
Public Sub LoadDirectoryNodes(ByVal...
|
by: e_man_online |
last post by:
Hi,
I get the following warning when building a VB .NET 2.0 project:
"Type of member 'CrystalReportViewer1' is not CLS-compliant"
What can I do to make the class CrystalReportViewer CLS...
|
by: Zhang Weiwu |
last post by:
http://www.w3.org/MarkUp/2004/xhtml-faq provided a trick to serve xhtml
webpage to IE as application/xml
I used that trick and now every one of my xhtml webpage have following
first 4 starting...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
| |