System.CLSCompliantAttribute cannot be applied to property 'Get'/'Set'

A property definition applies the CLSCompliantAttribute attribute to its Get or Set statement.

For a property to be compliant with the Common Language Specification (CLS), the entire property must be marked as <CLSCompliant(True)>. You must apply CLSCompliantAttribute to the Property Statement, not to either the Get or the Set statement.

When you apply 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 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: BC40043

To correct this error

  • Remove CLSCompliantAttribute from the Get or Set statement.

  • If the property should be CLS-compliant, mark the Property statement as <CLSCompliant(True)>.

See Also

Concepts

Writing CLS-Compliant Code

Reference

Get Statement

Set Statement (Visual Basic)