Troubleshooting in AL
Troubleshooting in AL covers tools and guidance for finding and fixing problems in Business Central extensions: the AL Profiler, VS Code debugging, snapshot debugging, Page Inspection, performance tuning for AL developers, and printing errors. It answers questions on diagnosing slow code, debugging errors, and inspecting pages.
Path: Development > Troubleshooting > Troubleshooting in AL · tier official · system development · narrative unreviewed (model text not yet checked)
Overview
This section collects the tools an AL developer uses when something is slow, wrong, or not printing. Debugging in Visual Studio Code is the base skill. It covers breakpoints, conditional breakpoints, breaking on errors or record changes, and attaching to a session. Snapshot debugging builds on it by recording execution on the server and replaying it offline.
For performance, the AL Profiler records where time is spent, using instrumentation or sampling, and shows call stacks, timings and SQL activity. The performance articles give design guidance on pages, web services, AL patterns, data access and testing. Page Inspection is a web client pane that shows page structure, source table fields, extensions and filters without reading code. A separate page covers printing problems.
Start with debugging in VS Code for functional errors. Use the AL Profiler and the performance articles for slow code. Use Page Inspection to understand what a page is built from.
Key points
- The AL Profiler offers instrumentation and sampling modes, set up in launch.json and viewed in VS Code. It has top-down and bottom-up call stack views, SQL call tracking, a Performance Profiler page and CodeLens inline timings.
- VS Code debugging supports breakpoints, conditional breakpoints, break on errors, break on record changes, and attach and debug next.
- Snapshot debugging records AL execution on a server and lets you debug the recording offline in VS Code using snappoints.
- Snapshot debugging can also be driven by an AI agent through the MCP server interface.
- Page Inspection in the web client shows page structure, source table and fields, extensions and filters.
- The performance articles cover page background tasks, partial records, set-based methods, columnstore indexes, SIFT indexes and Read Scale-Out.
- Troubleshooting Printing explains how to check printer payloads and read the Windows Event Log. It also explains how to test printer setups with the Printers system table.
Learn pages
- Analyze AL Performance with the AL Profiler: Use instrumentation or sampling with the AL Profiler to analyze AL execution, SQL activity, call stacks, and performance hot spots.
- Debug AL Code in Visual Studio Code: Debug AL code in Visual Studio Code by using breakpoints, attach sessions, record-write breaks, SQL statistics, and debugger settings.
- Inspecting pages: Learn about the structure of a page and its’ underlying data.
- Performance Articles for AL Developers: Learn how to write efficient AL code, pages, reports, and web services, and use tools like the AL Profiler to improve performance in Business Central.
- In the observatory: Page 2610 “Feature Management”, Page 9511 “Database Locks”
- Snapshot debugging: Overview of how snapshot debugging allows recording running AL code for Business Central.
- In the observatory: Codeunit 80 “Sales-Post”
- Troubleshooting Printing: Dynamics 365 Business Central supports different types of events including BusinessEvent, IntegrationEvent, Global, and trigger events.
- In the observatory: Page 64 “Printer Selections”
Videos and posts
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- Dynamics 365 Business Central: debugging agent sessions. (community post): “AL Language extension runtime 17.0 introduces debugging support for agent sessions”
- Help, I don’t get any AL warnings in the Output tab! (community post): “AL warnings may appear missing from the Output tab in VS Code”
- Dynamics 365 Business Central Blog Series: Debugging in AL (community post): “AL debugging techniques in Dynamics 365 Business Central, including snapshot”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.