Attributes cannot be generics or types nested inside generics

An attribute is declared as a generic type, or within a generic type.

Visual Basic and the .NET Framework do not currently support any combination of attributes and generic types. This means the following limitations apply:

  • An attribute cannot be a generic type or be declared within a generic type.

  • An attribute cannot inherit from a generic class, nor can a generic class inherit from an attribute.

  • When you apply an attribute, you cannot supply an argument that is any of the following:

    • A generic type,

    • A type constructed from a generic type,

    • A type parameter of a containing type, or

    • A type constructed from a type parameter of a containing type.

Error ID: BC32067

To correct this error

  • If the attribute declaration includes the Of keyword and a type parameter list, then remove them.

  • If the attribute declaration appears inside a generic type, then move it to where it is not inside any generic type.

See Also

Concepts

Attributes Overview in Visual Basic

Generic Types in Visual Basic

Reference

Attribute