APPLIES TO: Business Central 2020 release wave 2 and later
#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 haven't 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 its original state. If you don't
disable instruction is valid for the rest of the file.
app.json file, you can set the
NoImplicitWith flag to disable implicit
with when you've rewritten all code. For more information, see JSON Files.
With Business Central 2022 release wave 2, the AL:Go! template for creating new AL projects in Visual Studio Code, now enables explicit
with statements by default, by adding the
NoImplicitWith option to the
features property in the generated app.json file.
It's 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's recommended to rewrite code as described in Deprecating Explicit and Implicit With Statements.
#pragma implicitwith disable
#pragma implicitwith restore
For more background information and examples, see Deprecating Explicit and Implicit With Statements.