Snapshot Debugging
With snapshot debugging, you can record AL code that runs on the server, and when it has completed, debug the recorded snapshot in Visual Studio Code. The snapshot can be taken in Production environments since Business Central 17.2
In launch.json add a configuration like this:
{
"type": "al",
"request": "snapshotInitialize",
"tenant": "...",
"environmentType": "Production",
"environmentName": "Production",
"name": "Prod Debug",
"breakOnNext": "WebClient",
"executionContext": "Debug",
"sessionId": xyz
}
You start a snapshot with the command:
- AL: initialize snapshot debugging (F7)
- Then open a session in BC. If sessionId or userId is missing in the configuration above the snapshot will be based on the first session to connect to BC
- execute the code that you want to debug
- Finish snapshot debugger with Alt + F7
- Play snapshot: Shift + F7 and stop on snappoints set
AL Profiling
AL Profiler was introduced in Business Central 2021 release wave 2 and updated with sampling profiling for Business Central 2022 release wave 1.
Profiling allows you to collect data about performance and analyze this data with the goal of optimizing a certain area in the code or a certain process. The AL Profiler for the AL Language extension for Microsoft Dynamics 365 Business Central offers options for instrumentation profiling and sampling profiling. The AL Profiler is based on a snapshot of running code. The snapshot is a recording of running code that allows for later offline inspection. The AL Profiler is a powerful tool for analyzing performance in code written for Business Central
Here is a configuration for AL Profiling:
{
"name": "Snapshot",
"request": "snapshotInitialize",
"type": "al",
"tenant": "...",
"environmentType": "Sandbox",
"environmentName": "BC26",
"breakOnNext": "WebClient",
"executionContext": "DebugAndProfile",
"profilingType": "Instrumentation"
}
To perform snapshot AL profiling follow these steps:
- AL initialize snapshot debugging (F7)
- Then open a session in BC. If sessionId or userId is missing in the configuration above the snapshot will be based on the first session to connect to BC
- execute the code that you want to debug
- Finish snapshot debugger with Alt + F7
- AL: Generate profile file
The profile file for AL code has the extension .alcpuprofile and when you open the file, it displays in the performance profiling editor view in the Visual Studio Code.

Check my latest video for a quick overview: