Skip to content

Using #Insert without &ChangeAndValidate (InsertionWithoutChangeAndValidate)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Error BSL Critical Yes 1 error

Description

Using #Insert without &ChangeAndValidate (InsertionWithoutChangeAndValidate)

Diagnostic description

The #Insert / #EndInsert directive is used inside a method (procedure or function) that is not annotated with &ChangeAndValidate. This causes a module compilation error.

The #Insert and #EndInsert directives are intended for configuration extension code insertion. The platform only allows them in methods annotated with &ChangeAndValidate, which explicitly declare the intent to modify the code of the extended object.

Insertion at the module level (outside methods) does not require the annotation and is not reported by this diagnostic.

Examples

Incorrect

Procedure AddAttribute()

    #Insert
    ... // insertion code
    #EndInsert

EndProcedure

Correct

&ChangeAndValidate
Procedure AddAttribute()

    #Insert
    ... // insertion code
    #EndInsert

EndProcedure

See also

Snippets

Diagnostic ignorance in code

// BSLLS:InsertionWithoutChangeAndValidate-off
// BSLLS:InsertionWithoutChangeAndValidate-on

Parameter for config

"InsertionWithoutChangeAndValidate": false