Type '<typename1>' cannot be marked CLS-compliant because its containing type '<typename2>' is not CLS-compliant

A class or interface is marked as <CLSCompliant(True)> when it is nested in a type that is marked as <CLSCompliant(False)> or is not marked.

For a class or interface to be compliant with the Common Language Specification (CLS), its entire containment hierarchy must be compliant. That means every type in which it is nested must be compliant.

When you apply the CLSCompliantAttribute to a programming element, you set the attribute's isCompliant parameter to either True or False to indicate compliance or noncompliance. There is no default for this parameter, and you must supply a value.

If you do not apply the CLSCompliantAttribute to an element, it is considered to be noncompliant.

By default, this message is a warning. For information on hiding warnings or treating warnings as errors, see Configuring Warnings in Visual Basic.

Error ID: BC40030

To correct this error

  • If you require CLS compliance, define this type within a different containment hierarchy.

  • If you require that this type remain within its current containment hierarchy, remove the CLSCompliantAttribute from its definition or mark it as <CLSCompliant(False)>.

See Also

Concepts

Writing CLS-Compliant Code