Return type of function not CLS-compliant

G

Guest

Using VB.Net 2005.

I have my interfaces and enums defined in a DLL. For example, I have this
enum:
Public Enum OpStatusTypes
Normal
InProgress
Paused
End Enum


In another DLL I reference that DLL and expose a property based on the enum:

Public ReadOnly Property OpStatus() As OpStatusTypes
Get
Return m_OpStatus
End Get
End Property

The compiler gives me the subject warning -- why?
What concerns should I have about this?


'
 
B

Bill McCarthy

Hey Doug,

I wouldn't worry about it. The underlying type is Int32 (implied)
And even if you used an unsigned int as the underlying type, which wouldn't
be CLS compliant, both VB and C# support them as of 2005.
 
H

Herfried K. Wagner [MVP]

Bill McCarthy said:
I wouldn't worry about it. The underlying type is Int32 (implied)
And even if you used an unsigned int as the underlying type, which
wouldn't be CLS compliant, both VB and C# support them as of 2005.

I thought unsigned types became CLS compiliant since .NET 2.0.
 
B

Bill McCarthy

Herfried K. Wagner said:
I thought unsigned types became CLS compiliant since .NET 2.0.

Nope. Generics are, but UInt16, UInt32 and UInt64 remain non compliant.
 
G

Guest

Hi Bill:

Ok, so I won't worry about it -- it just bugs me that I am getting the
warning.

thx!

--
Doug.



Bill McCarthy said:
Hey Doug,

I wouldn't worry about it. The underlying type is Int32 (implied)
And even if you used an unsigned int as the underlying type, which wouldn't
be CLS compliant, both VB and C# support them as of 2005.
 
B

Bill McCarthy

Hi Doug,

You shouldn't be if all assemblies are marked with CLS compliant. But yeh,
nothing to worry about anyway really ;)



Douglas Marquardt said:
Hi Bill:

Ok, so I won't worry about it -- it just bugs me that I am getting the
warning.

thx!
 
G

Guest

Hi Bill:

"all assemblies are marked with CLS compliant"

I added this to the AssemblyInfo:

<Assembly: CLSCompliant(True)>

Is that what you mean?
 
B

Bill McCarthy

Hi Doug,

Yep. And make sure the dll's you are referencing, especially the one that
contains the Enum is also marked with the same attribute


Douglas Marquardt said:
Hi Bill:

"all assemblies are marked with CLS compliant"

I added this to the AssemblyInfo:

<Assembly: CLSCompliant(True)>

Is that what you mean?
 
G

Guest

Will Do, thanks!

--
Doug.



Bill McCarthy said:
Hi Doug,

Yep. And make sure the dll's you are referencing, especially the one that
contains the Enum is also marked with the same attribute
 

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

Similar Threads


Top