The CLS (Common Language Specification) is a set of constraints on APIs and a complementary set of requirements on languages. If a library is CLS-compliant (i.e. adheres to all the constraints), then any CLS-compliant language can use that API. Conversely, a CLS-compliant language is guaranteed to be able to use any CLS-compliant library. (Int32 is an example of a CLS-compliant type, so CLS guarantees it's safe for library writers to use it in their APIs.)
Questions tagged [cls-compliant]
103 questions
3
votes
3 answers
What are the more advanced rules needed for your code to become CLS-complaint?
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…

Chad Braun-Duin
- 2,188
- 2
- 19
- 26
3
votes
0 answers
Change name of field of .net class in assembly
Is it possible to change a name of a field in .net assembly? I use that assembly in some case insensitive scripting environment which complains that this public field is not CLS compliant. In the same class there is a property with the same name,…

Andrey
- 81
- 1
- 4
3
votes
1 answer
Jagged array CLS-compliance different in C# and VB?
According to Common Language Specification, overload resolution for methods that have array parameters is based on the fact that they are arrays and on their element type. So the following code should be compliant (which it is) because Double()() is…

Fuzhou Hu
- 528
- 2
- 8
3
votes
1 answer
CLS compliance issue in VB.NET
What is not CLS compliant about the simple class below?
I get the warning that my derived class is not CLS compliant, because it inherits from the class below, which is not CLS compliant (apparently).
Public MustInherit Class BaseModel
…
user2057873
3
votes
1 answer
Are there any non CLS compliant .NET languages in common use?
Are there any non CLS compliant .NET languages in common use these days? It looks like every managed language that ships out of the box with VS2012 supports unsigned integer types, so practically speaking how much trouble is one likely to get into…

Tom Kirby-Green
- 181
- 1
- 5
3
votes
0 answers
I need other syntax for RDLC Expression " =Fields!xxx.Value" where xxx contains dot(.)
I am generating report dynamically.
I have two tables User and Branch, and both have column name 'NAME'. So I use 'User.Name' and 'Branch.Name' as ColumnName in DataTable and bind it to RDLC using following code:
foreach(DataColumn dc in…

Shweta patel
- 105
- 11
2
votes
3 answers
Pattern for naming CLS compatible alternative Properties
If i have a property like this
[CLSCompliant(false)]
public uint Something { ... }
and want to write an alternative, i can not just write an overload as i would do for methods.
But how should i name it? Is there some general way in the .NET…

ordag
- 2,497
- 5
- 26
- 35
2
votes
3 answers
When is it acceptable to break CLS compliance?
I was wondering which edge cases exist that could make Common Language Specification compliance acceptable. Even when not intending to be accessed from other languages, I think that the tenets asserted by the CLSCompliantAttribute are good best…

David Schmitt
- 58,259
- 26
- 121
- 165
2
votes
2 answers
How does the BCL relate to the CLS?
Some .net Theory question: Which libraries are actually standardized? I know that there is the Common Type System which specifies things like 32-Bit Integers and all this low level info, but I'm confused about the status/relation of the Common…

Michael Stum
- 177,530
- 117
- 400
- 535
2
votes
3 answers
Possibility of language data type not mapped to shipped .NET Framework?
Does anybody know of a managed programming language implemented on .NET that contains a specialized data type that is not mapped through to the Common Type System/FCL/BCL or one that does not have a shipped .NET equivalent (e.g. shipped standard…

John K
- 28,441
- 31
- 139
- 229
2
votes
0 answers
Mandelbug: Unwanted transitive assembly references required by compiler; CLS compliance; visibility
Overview
Debugging an interesting bug, I stripped down a solution to its bare bones in an attempt to isolate it. The issue manifests itself with a classic build error (assembly not referenced).
What's interesting is that no types from the assembly…

tne
- 7,071
- 2
- 45
- 68
2
votes
2 answers
Marking all classes in a project CLS Compliant
If I have a project and I mark it as
Do I need to put CLSCompliant(True) before every class in the project, or are they all defaulted to CLSCompliant?

Cylindric
- 5,858
- 5
- 46
- 68
2
votes
0 answers
mshtml cls-compliant unknown warnings
I have a .net project written in C#. There is only 1 class in the project that uses the Microsoft.mshtml library, however there are 2 classes in the project that are generating mshtml warnings on build. Here are a couple of examples of the…

flamebaud
- 978
- 1
- 9
- 26
2
votes
0 answers
mshtml and CLS-compliance
I am witnessing some odd behaviour with mshtml and CLS-compliance.
I have an assembly marked CLSCompliant(true). This assembly does not expose any types from mshtml publicly.
I can make the code conform to CLS fairly easily, but several things seem…

Stephen Drew
- 1,415
- 19
- 31
1
vote
1 answer
Does CLSCompliant attribute care for older versions of .NET languages?
For instance, I read that visual basic .net didn't have operator overloads before, so wouldn't be able to use a types overloaded operators, if they aren't provided as normal methods too (Add, instead of operator+).
Now that VB has this feature,…

Joan Venge
- 315,713
- 212
- 479
- 689