views:

585

answers:

2

I have a couple of nagging compiler warnings for an app that I ported from VB6 a while back regarding CLS-Compliance including:

Name '_AnIdentifier' is not CLS-Compliant.
Type of parameter 'myType' is not CLS-Compliant.

Despite this, my app seems to perform just fine from COM and Managed clients. I have seen several articles describing what to do to make the code CLS-Compliant and I probably will go ahead and do it anyway to get rid of the nagging warnings, but I am curious what the drawbacks of non-CLS compliant code are in practical terms? What limitations is this imposting that I haven't discovered yet?

+5  A: 

Basically, your class may not be accessible (or may act oddly, such as large positive numbers being treated as negative), when used with some .NET languages. I cannot say what languages they might be.

For example, I don't believe a language is required to recognize an identifer that begins with an underscore. C# allows it, so you're safe there, but for other languages, "_AnIdentifier" may be hidden, or have a system generated name.

James Curran
+1  A: 

I've run into issues with obfuscation tools generating incorrect obfuscated code when code that isn't CLS-compliant is obfuscated.

Joseph Anderson