Return type of function not CLS-compliant

  • Thread starter Thread starter Guest
  • Start date Start date
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?


'
 
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.
 
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.
 
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.
 
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.
 
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!
 
Hi Bill:

"all assemblies are marked with CLS compliant"

I added this to the AssemblyInfo:

<Assembly: CLSCompliant(True)>

Is that what you mean?
 
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?
 
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
 
Back
Top