CLS Compliance

G

Guest

I have a number of classes, none of which use non CLS Compliant data types.
These classes are compiled into an assembly.
however when using this assembly a function (for example) that returns one
of these classes gives a compiler warning "Return type of MyFunction is not
CLS compliant"
this occurs with every class in the assembly.

why is this?

--guy--
 
G

Guest

got it!

its because the code is migrated vb2003!

if i create a new project and copy/paste the code in evertything is fine!

--guy--
 
T

ThunderMusic

hi,
can someone explain why? Is it documented somewhere? because I plan on
migrating much much much code from VB2003 to VB2005 in a near future, so I
want to know if it's normal behavior or if there are precise cases where it
does that...

Thanks

ThunderMusic
 
G

Guest

Hi,
i cant explain it but...

Note The current Microsoft Visual Basic compiler intentionally does not
generate a CLS-compliance warning, however, a future release of the compiler
will issue that warning.

from:-
http://msdn.microsoft.com/library/d...rlrfsystemclscompliantattributeclasstopic.asp

wether this is significant i dont know.

basically what i did intitally was create a vb2005 project and add in a vb
2003 vb class file this project referenced some vb 2005 assemblies, all of
which then appeared as non cls compliant.

for the second attempt i created another vb2005 project, created an empty
class file and pasted in the code from the vb2003 class, then set up the
references and all was fine!

a colleague has experienced identical problems

it ***might*** be something to do with referncing the vb2005 assemblies, buy
i havent tried this.
looking at posts on the net this seems a common problem, but i havent seen
an explanation:-(

hth

---guy---
 
T

ThunderMusic

thanks a lot... it will probably save me some time to know at least one way
to solve the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top