Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top