Udostępnij za pośrednictwem


Non-CLS-compliant 'MustOverride' member is not allowed in a CLS-compliant <classname>

A class is marked as <CLSCompliant(True)>, but it contains a MustOverride property or procedure that is marked as <CLSCompliant(False)> or is not marked.

When a class is compliant with the Common Language Specification (CLS), an application that uses that class accesses only the members that are also marked as <CLSCompliant(True)> and ignores the members that are not. However, the application cannot ignore a MustOverride property or procedure, because it must access that property or procedure to override it.

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: BC40034

To correct this error

  • If you require CLS compliance and have control over the class source code, mark the member as <CLSCompliant(True)>.

  • If you require CLS compliance and do not have control over the class source code, or if it does not qualify to be compliant, define this member within a different class.

  • If you require that this member remain noncompliant, remove the MustOverride keyword from its definition, remove the CLSCompliantAttribute from the class definition, or mark the class as <CLSCompliant(False)>.

See Also

Concepts

Writing CLS-Compliant Code

Reference

MustOverride