Pragma ImplicitWith

APPLIES TO: Business Central 2020 release wave 2 and later

The #pragma implicitwith instruction changes the compiler behavior to not create an implicit with. This can be used as a temporary solution to avoid getting warnings on the usage of implicit with statements in the code, that you plan on rewriting but just have not fixed yet. With the #pragma implicitwith disable you disable the emit of implicit with warnings for a specific location in code that follows the instruction, and with #pragma implicitwith restore you restore the warning back to it's original state. If you do not restore, the disable instruction is valid for the rest of the file.

In the app.json file, you can set the NoImplicitWith flag to disable implicit with when you have rewritten all code. For more information, see JSON Files.

Important

It is important to be aware that the implicitwith warning will become an error in a future release and therefore suppressing it should be a temporary solution. It is recommended to rewrite code as described in Deprecating Explicit and Implicit With Statements.

Syntax

#pragma implicitwith disable
#pragma implicitwith restore

Example

For more background information and examples, see Deprecating Explicit and Implicit With Statements.

See Also

Development in AL
AL Development Environment
Pragma Directive in AL
Conditional directives
Deprecating Explicit and Implicit With Statements