Skip to content

Compilation directive is not available in this module type (CompilationDirectiveNotAllowed)

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

Description

The set of compilation directives depends on the module type:

  • a managed form module accepts &AtClient, &AtServer, &AtServerNoContext, &AtClientAtServerNoContext;
  • a command module accepts &AtClient, &AtServer, &AtClientAtServer.

A directive from another module type's set is parsed without a syntax error but is not defined for this module. The most common case is &AtClientAtServer in a form module instead of &AtClientAtServerNoContext: the method becomes unavailable to some callers, and the behavior depends on the client type. For example, a call to such a method from a server procedure of the form does not compile, and the form does not open.

Examples

Incorrect (form module):

&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
    UpdateAppearance(ThisObject);
EndProcedure

&AtClientAtServer
Procedure UpdateAppearance(Form)
    ...
EndProcedure

Correct:

&AtClientAtServerNoContext
Procedure UpdateAppearance(Form)
    ...
EndProcedure

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:CompilationDirectiveNotAllowed-off
// BSLLS:CompilationDirectiveNotAllowed-on

Parameter for config

"CompilationDirectiveNotAllowed": false