Warning Msg: Name '_ClassColumn' is not CLS-compliant.

  • Thread starter Thread starter moondaddy
  • Start date Start date
M

moondaddy

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 '_ClassColumn' is not CLS-compliant.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\wsvipn2006\4b065968\dadaeae0\Sources_App_Code\wsvipn2006.dsuser.xsd.8a6308fa.vb
2606 38 http://localhost/wsVIPN2006/

I'm trying to go through all my projects and to resolve all warnings after
converting to 2.0. How can I resolve this with out corrupting things?
 
Hi moondaddy,

If you double click on the warning, which line of code does the stops on?
Could you paste that part of code here?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _ Public ReadOnly
Property _RegionColumn() As System.Data.DataColumn
Get
Return Me.column_Region
End Get
End Property

And here's the corisponding warning

Warning 151 Name '_RegionColumn' is not CLS-compliant.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\wsvipn2006\4b065968\dadaeae0\Sources_App_Code\wsvipn2006.dsuser.xsd.8a
6308fa.vb 2620 38 http://localhost/wsVIPN2006/

Thanks.
 
Moondaddy,

It can be that the code is created first as C#.

Have a look if the column_Region is maybe public/friend declared with the
same name somewhere but with an other upper/lower case. This is allowed in
C# but is not CLS compliant.

I hope this helps,

Cor
 
moondaddy said:
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 '_ClassColumn' is not CLS-compliant.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\wsvipn2006\4b065968\dadaeae0\Sources_App_Code\wsvipn2006.dsuser.xsd.8a6308fa.vb
2606 38 http://localhost/wsVIPN2006/

I'm trying to go through all my projects and to resolve all warnings after
converting to 2.0. How can I resolve this with out corrupting things?


I had a similar problem when upgrading. I'm not sure I understand what was
wrong completely, but it involved this line in my AssemblyInfo.vb file:

<Assembly: CLSCompliant(True)>

I decided to just delete the AssemblyInifo.vb file, since VB 2005 handles
this differently somehow(?). (New projects don't even have this file.) That
cleared up my problem. It seemed to me at the time maybe the default
CLSCompliant is False? (I never set it to True in my VB 2003 project, not
sure how it got that way.) I assume it is using some default when the
AssemblyInfo.vb is not present.

Maybe somebody more in the know can clue me in.

It seems to me there is a bigger issue here. I assume we would want this
set to True. But I also assume leaving things at their defaults (by
removing AssemblyInfo.vb) should be OK also.

Thoughts anyone?

Greg
 
Hi Greg,

Please check Cor's post. The member of the class might be different in case
but with the same characters.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Kevin Yu said:
Hi Greg,

Please check Cor's post. The member of the class might be different in
case
but with the same characters.

I took another look at my upgraded project.

I see AssemblyInfo.vb file is still alive and well. (I had forgotten it is
now a hidden file under the My Project folder).

By default (in VB 2005), this line is not present:
<Assembly: CLSCompliant(True)>

It was present in my VB 2003 project (and appears to be the default for new
2003 projects). If I add it back I get the below warnings. If I delete it,
or set it to false, the warnings go away.

warning BC40031: Name '_mainConnection' is not CLS-compliant.
warning BC40031: Name '_rowsAffected' is not CLS-compliant.
warning BC40031: Name '_errorCode' is not CLS-compliant.
warning BC40031: Name '_mainConnectionIsCreatedLocal' is not CLS-compliant.
warning BC40031: Name '_mainConnectionProvider' is not CLS-compliant.

I don't see anything in my code that would suggest I have a casing problem
with these variables as suggested by Cor.

What I did determine is that if I create ANY variables Public or Protected
(but not Private) whose names starts with an underscore I get the warning.

example:
Protected _foobar as Integer

So my questions are:

#1 Why is the default to have <Assembly: CLSCompliant(False)> (apparently,
since the line is not present in AssemblyInfo.vb) ?
#2 Why is the default different than 2003?
#3 How do you change this now in VS 2005 IDE without editing the
AssemblyInfo.vb file manually?
#4 What is the problem with the underscore _ character with Public
variables? (I think I know this one, but want to hear other opinions)

Greg
 
Hi Greg,

Thanks for the exact warning message. A programming element can contain one
or more underscores, but to be compliant with the Common Language
Specification (CLS), it must not begin with an underscore. See Declared
Element Names.

You can check the following link for more information on this warning.

http://msdn2.microsoft.com/en-us/library/k5645wwb.aspx

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Did you ever solve your 'is-compliant' issue because I'm receiving lots
of these warnings and even errors which should be warnings during my
conversion to 2005.

The leading underscore does not apply for me.
 
I too have had naming problems related to conversion from 2003, where xsd
names were modified with underscore underscores inserted preceding the column
names. Apparently there is a compatibility issue here between 2003 and 2005.
If the Assembly.vb is modified what impact does that have in anything we do
with the project?
 
Hi Kevin,
I realize that I am responding to an early thread. but I would like some
guidance here.
I did not prefix my database column names, the 2003 ide was responsible.
There is apparently some incompatability issue with 2005. There were
mentioned that setting entry in the Assemblyinfo.vb to false would eliminate
the problem. Since this parameter was set false in vs2003, what are the
implications of setting this parameter false in vs2005?
 
Back
Top