Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any reason not to mark a DLL as CLSCompliant?

I am currently testing out Ndepend, and it gives me a warning that assemblies should be marked as CLSCompliant.

Our project is all C#, so it is not really needed.

What I am wondering is: are there any negative effects of marking a dll as clscompliant or should I just disable the warning?

Note I am not asking what CLSCompliant means that is covered here: What is the 'CLSCompliant' attribute in .NET?

like image 974
Shiraz Bhaiji Avatar asked Aug 08 '11 12:08

Shiraz Bhaiji


1 Answers

This is one of those subtle cases... CLS compliance is probably of most importance to library authors, who can't control who the caller is. In your case, you state "our project is all C#", in which case you are right: it isn't needed. It adds restrictions (for example, on unsigned types) which might (or might not) affect representing your data in the most obvious way.

So: if it adds no value to you whatsoever, then frankly: turn that rule off. If you can add it for free (no code changes except the attributes), then maybe OK - but everything is a balance - effort vs result. If there is no gain here, don't invest time.

If you are a library author (merchant or OSS), then you should follow it.

like image 101
Marc Gravell Avatar answered Sep 24 '22 21:09

Marc Gravell