{"title":"Control AL compiler warnings with pragma directives","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/directives/devenv-directive-pragma-warning/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/directives/devenv-directive-pragma-warning, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/directives/devenv-directive-pragma-warning","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Learn how to use the pragma warning directive in AL to suppress and restore configurable compiler warnings in Microsoft Dynamics 365 Business Central.","date":"2026-10-05","meta":{"topic":"concept-article"},"outline":[{"level":1,"title":"Control AL compiler warnings with pragma directives","slug":"control-al-compiler-warnings-with-pragma-directives","at":0,"chars":1794},{"level":2,"title":"Syntax","slug":"syntax","at":519,"chars":104},{"level":2,"title":"Parameters","slug":"parameters","at":623,"chars":517},{"level":2,"title":"Example","slug":"example","at":1140,"chars":340},{"level":2,"title":"Related information","slug":"related-information","at":1480,"chars":314}],"text":"# Control AL compiler warnings with pragma directives\n> APPLIES TO: Business Central 2020 release wave 2 and later\nThe `#pragma warning disable` directive suppresses specified compiler warnings from its location until a matching `#pragma warning restore` directive or the end of the file. If you omit the warning list, the directive applies to all configurable warnings.\n> IMPORTANT\n> Suppress warnings only when you can't address their cause. A warning can become an error in a later release and break your extension.\n## Syntax\n```al\n#pragma warning disable warning-list\n```\n```al\n#pragma warning restore warning-list\n```\n## Parameters\nwarning-list\nA comma-separated list of warning IDs or numeric warning codes, such as `AL0468, AL0604`.\nWhen you don't specify warning IDs, disable suppresses all configurable warnings from that point forward. restore clears the pragma warning state and returns all warnings to their default or project-configured reporting state.\n> NOTE\n> To find warning IDs, build your AL project in Visual Studio Code and check the Output window. Learn more about code analysis in ../devenv-using-code-analysis-tool.\n## Example\nThe following example illustrates how the specific rule AL0468 is temporarily turned off for a specific field definition.\n```al\ntable 50110 MyTable\n{\n    fields\n    {\n        #pragma warning disable AL0468\n        field(1; TableWithLongIdentifierThatExceedsOurMax; Integer) { }\n        #pragma warning restore AL0468\n    }\n}\n```\n## Related information\nDevelopment in AL<../devenv-dev-overview>\nAL development environment<../devenv-reference-overview>\nPragma directive in AL<devenv-directive-pragma>\ndevenv-directives-in-al#conditional-directives\nDeprecating explicit and implicit with statements<../devenv-deprecating-with-statements-overview>"}