'System.ObsoleteAttribute' cannot be applied to the 'AddHandler', 'RemoveHandler', or 'RaiseEvent' definitions

'System.ObsoleteAttribute' cannot be applied to the 'AddHandler', 'RemoveHandler', or 'RaiseEvent' definitions. If required, apply the attribute directly to the event.

A custom event applies the ObsoleteAttribute to its AddHandler, RemoveHandler, or RaiseEvent procedure.

The ObsoleteAttribute marks a programming element as no longer in use and informs users that the element is to be removed in future versions of the product.

It is not meaningful to have certain parts of a custom event still in use while others are no longer in use.

Error ID: BC31142

To correct this error

  • Remove the ObsoleteAttribute from the individual procedure declaration and apply it to the overall event declaration.

See also