Name <membername> is not CLS-compliant

An assembly is marked as <CLSCompliant(True)> but exposes a member with a name that begins with an underscore (_).

A programming element can contain one or more underscores, but to be compliant with the Common Language Specification (CLS), it must not begin with an underscore. See Declared Element Names.

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

To correct this error

  • If you have control over the source code, change the member name so that it does not begin with an underscore.

  • If you require that the member name remain unchanged, remove the CLSCompliantAttribute from its definition or mark it as <CLSCompliant(False)>. You can still mark the assembly as <CLSCompliant(True)>.

See Also

Concepts

Declared Element Names

Visual Basic Naming Conventions

Writing CLS-Compliant Code