|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Why isnt this CLS compliant?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 I believe "as Int64" is the culprit
to prove/disprove, change it temporarily to Integer Show quoteHide quote "Smokey Grindle" <nospam@dontspamme.com> wrote in message news:OrpfWf68GHA.1252@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 Show quoteHide quote "gs" <gs@dontMail.telus> wrote in message news:emevEl68GHA.3736@TK2MSFTNGP02.phx.gbl... >I believe "as Int64" is the culprit > > to prove/disprove, change it temporarily to Integer > > "Smokey Grindle" <nospam@dontspamme.com> wrote in message > news:OrpfWf68GHA.1252@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 ''' </summary> lines Mike. Show quoteHide quote "Smokey Grindle" <nospam@dontspamme.com> wrote in message news:OrpfWf68GHA.1252@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
Show quoteHide quote "Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message news:uTJF3A78GHA.1188@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 ''' > </summary> lines > > Mike. > > "Smokey Grindle" <nospam@dontspamme.com> wrote in message > news:OrpfWf68GHA.1252@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 Show quoteHide quote "Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message news:uTJF3A78GHA.1188@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 ''' > </summary> lines > > Mike. > > "Smokey Grindle" <nospam@dontspamme.com> wrote in message > news:OrpfWf68GHA.1252@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. Show quoteHide quote "Claes Bergefall" <louplou@nospam.nospam> wrote in message news:%23xqROkF9GHA.4084@TK2MSFTNGP05.phx.gbl... > You need to remove the blank lines in between them. > > /claes > > "Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message > news:uTJF3A78GHA.1188@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 ''' > > </summary> lines > > > > Mike. > > > > "Smokey Grindle" <nospam@dontspamme.com> wrote in message > > news:OrpfWf68GHA.1252@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 Show quoteHide quote "Smokey Grindle" <nospam@dontspamme.com> wrote in message news:OrpfWf68GHA.1252@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
Show quoteHide quote "Claes Bergefall" <louplou@nospam.nospam> wrote in message news:OpVdfjF9GHA.2288@TK2MSFTNGP05.phx.gbl... > Works just fine for me. I'm not getting any warnings in .NET 2005 > > /claes > > "Smokey Grindle" <nospam@dontspamme.com> wrote in message > news:OrpfWf68GHA.1252@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 Show quoteHide quote "Smokey Grindel" <nospam@nospam.net> wrote in message news:%23vIKm1I9GHA.3960@TK2MSFTNGP05.phx.gbl... : wierd its still throwing a CLS warrning to this day for me : : "Claes Bergefall" <louplou@nospam.nospam> wrote in message : news:OpVdfjF9GHA.2288@TK2MSFTNGP05.phx.gbl... : > Works just fine for me. I'm not getting any warnings in .NET 2005 : > : > /claes : > : > "Smokey Grindle" <nospam@dontspamme.com> wrote in message : > news:OrpfWf68GHA.1252@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. Show quoteHide quote "Smokey Grindel" <nospam@nospam.net> wrote in message news:%23vIKm1I9GHA.3960@TK2MSFTNGP05.phx.gbl... > wierd its still throwing a CLS warrning to this day for me > > "Claes Bergefall" <louplou@nospam.nospam> wrote in message > news:OpVdfjF9GHA.2288@TK2MSFTNGP05.phx.gbl... > > Works just fine for me. I'm not getting any warnings in .NET 2005 > > > > /claes > > > > "Smokey Grindle" <nospam@dontspamme.com> wrote in message > > news:OrpfWf68GHA.1252@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. -- Show quoteHide quoteHope this helps Jay B. Harlow ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "Smokey Grindle" <nospam@dontspamme.com> wrote in message news:OrpfWf68GHA.1252@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 > >
Config file for DLL??
Searching desparately for createmailslot example in VB.NET (MSDN universal Subscriber) Show ToolTip on every Control continuously Transparent My.Settings wont update?? listview determining current winform application is active, has focus or being used Compressing textfiles, but still read them changing book for study Upgrading a project, "Invalid Image" exception? |
|||||||||||||||||||||||