[Mono-list] Mono & CLS compliant code
Wed, 05 Feb 2003 20:43:08 +0100
I have been experimenting with enabling CLS compliance for a certain
assembly (Mono.PEToolkit, but maybe I better start with a different one).
(this is the first thing that is triggered by the FxCop rules).
Anyway, you can trigger csc to check for CLS compliance by adding the
following in a source file of the assembly:
Now, when I build things with csc I get a bunch of errors, (obviously)
because csc now checks for CLS compliance.
Errors (in Mono.PEToolkit) include the following:
* MDToken.cs(135,44): error CS3001: Argument type 'uint' is not
* MDUtils.cs(50,41): error CS3001: Argument type 'void*' is not
* Characteristics.cs(10,14): error CS3009:
'Mono.PEToolkit.Characteristics': base type 'ushort' is not CLS-compliant
* Mono.PEToolkit\Image.cs(211,23): error CS3005: Identifier
'Mono.PEToolkit.Image.MetaDataRoot' differing only in case is not
* LEBitConverter.cs(115,41): error CS3001: Argument type 'ulong' is not
* LEBitConverter.cs(115,24): error CS3002: Return type of
'Mono.PEToolkit.LEBitConverter.SwapUInt64(ulong)' is not CLS-compliant
Now before I go ahead and start working on a patch, I really want to
know if we want everything to be CLS compliant. Looking at the errors I get,
it probably wouldn't hurt if everyone else followed some kind of
guideline to write CLS compliant code (for new code). I certainly don't
want to break any currently working code.
Is there a list of 'official' assemblies & if they are CLS compliant?
(my guess is at least those officially being CLS compliant must be done)
Next question is, how difficult would it be to add CLS compliance checks
in mcs (when the CLSCompliantAttribute is true)?