1
Vote

CLS Compliance

description

I'm attempting to use the Prism Library in my application, which I want to be CLS Compliant. The problem is that even though the Prism Library IS CLS Compliant, it does not have the appropriate attribute specifying that it is. This causes any types that I create to extend the types from within prism to be marked as non-CLS compliant, as well as other issues.
 
For example, when I attempt to use the Notification class as a parameter in my method, it is impossible to do so for a public/protected abstract method. If I attempt to mark the method as CLSCompliant(false) then I get a compiler error CS3011. If I remove the attribute then I get a compiler error stating that "Argument type 'Microsoft.Practices.Prism.Interactivity.InteractionRequest.Notification' is not CLS-Compliant."
 
Please apply the CLSCompliant(true) attribute to the assemblies. Thank you.

comments

aadami wrote Aug 17, 2012 at 5:51 PM

Hi,

After analyzing the assemblies in the Prism library, I confirmed that the Microsoft.Practices.Prism.Interactivity assembly has not the CLSCompliantAttribute and as mentioned in this article (http://msdn.microsoft.com/en-us/library/bhc3fa7f%28v=vs.100%29.aspx) an assembly that is not marked as CLS-compliant is considered to be not CLS compliant.

Hence, I believe, that adding the CLSCompliant attribute to this assembly could be a valid suggestion, to avoid this kind of errors.

Also, as an alternative I believe you could also try marking the class that contains the abstract method with the [CLSCompliant(false)] attribute (instead of marking the method). This could help to avoid the CS3011 error which states that:

A class member cannot be both abstract and non-compliant with the Common Language Specification (CLS). The CLS specifies that all class members shall be implemented.

Regards,

Agustin Adami
http://blogs.southworks.net/aadami