Business Central 2022 wave 2 (BC21) new features: Visualize code lines executed in snapshot capture (Snapshot Debugger Lines Hit Decoration)

Dynamics 365 Business Central

Hi, Readers.
The preview environment for Dynamics 365 Business Central 2022 release wave 2 (BC21) is available. Learn more: Link.

I will continue to test and share some new features that I hope will be helpful.

Visualize code lines executed in snapshot capture:

Business value:

Snapshot debugging is a powerful way of troubleshooting Business Central cloud production environments. Because snapshot captures are non-interactive, snappoints must be set beforehand, typically making snapshot debugging an iterative process. To increase efficiency in determining which code was actually executed—for example, conditional code paths—and help locate good candidates for setting new snappoints to investigate variable state for code execution, visual cues have now been added to the snapshot playback. These cues are displayed as vertical lines in the left gutter of the code editor.

As you might know, 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. Snapshot debugging lets you inspect code execution and variables in the production environment on a cloud service for a specified user session.

Last year we discussed how to use Snapshot Debugging in Business Central. More details: Snapshot Debugging (Debugging in Cloud Production)
And you can find more about Snapshot Debugging in MS Docs.

With 2022 wave 2, Microsoft brought us a small improvement.

During snapshot playback in Visual Studio Code, the left-side code editor gutter contains a vertical visual bar to indicate which code was executed in the snapshot capture.

For example,

The color of the gutter bar can be controlled using the new al.snapshotDebuggerLinesHitDecoration in the settings.json file.

Specifies the decoration values for a line that is hit by the snapshot debugger.

Give it a try!!!😁

PS: The vertical visual bar is not displayed in normal debugging.


Hope this will help.

Thanks for reading.