Here is a specific example which is not CLS-complaint according to VS.NET 2005.
Public Interface IDbId
Function GetNativeObject() As Object
Function Equals(ByVal compObj As IDbId) As Boolean
Function CompareTo(ByVal compObj As IDbId) As Integer
Function ToString() As String
End Interface
This is an interface I implement with classes such as DbId32, DbId64, DbIdString, etc. It is a way to abstract the native database primary key type into one common .Net type.
What I'm not displaying is the factory method which instantiates the correct concrete type (ie new DbId32 for a SQL Server type 'int', for example) given a native database type.
Now let's say I go to use this interface like so:
Public MustOverride ReadOnly Property ID() As IDbId
VS now outputs this warning message:
Return type of function 'ID' is not CLS-complaint.
I can stop these warnings by adding this attribute to my interface like so:
<CLSCompliant(True)> _
Public Interface IDbId
...
None of the functions this interface defines seem to break the rules documented here. So why is VS displaying these warnings?