Tuesday, October 18, 2022

Snapshot Debuging for Debug Error in BC SaaS Production Environment

 Dear Friends,

We can use the Snapshot debugging to Debug in Production Environment

Below are simple setup process.

Step1: AL: Initialize a snapshot debugging session on cloud

Go to Launch.json file and select below option to generate configuration

 




















Configuration Update as Below

 {

                "name": "snapshotInitialize: Microsoft production cloud",

                "type": "al",

                "request": "snapshotInitialize",

                "environmentType": "Production",

                "environmentName": "production",

                "tenant": "032eef50-e555-41c9-95b2-3e2e2fbd8bdd",

                "breakOnNext": "WebClient",

                "userId": "BCADMIN",

                "executionContext": "DebugAndProfile",

                "snapshotVerbosity": "Full"

            }




















Below Message will show once successfully snapshot debug run

On Press of F7 – It will start snapshot debug













Snapshot debugging keyboard shortcuts:

F7 = Start a snapshot debugging session

Shift+F7 = List all available snapshots

Alt+F7 = Finish a snapshot debugging session

 

Now when you login to BC Production Environment using BCADMIN user you will receive below message

 













Now you can process the steps and generate the error.

I have block 10000 customer and just try to create the sales order for that customer

I have receive below error.





















When the scenario is finished, you can press Ctrl+Shift+P and then select AL: Finish snapshot debugging on the server or by pressing ALT + F7.






The snapshot is downloaded as a ZIP file to the .snapshots folder in your VS Code project. And the debug icon on the status bar will be orange now.

By clicking on debug icon, you can see the list of the downloaded snapshots









Select the snapshot and start the Snapshot Debugging and it will automatic break at a point when the error is coming.












PS: Breakpoints can be added and removed and they will be hit if given a breakpoint; the breakpoint is in the execution context of a recorded state. This means that if walking the execution stack for a breakpoint and the next stepped line is reached, then the code will break on the breakpoint.














You can also set breakpoints in Base Application (dal file).












For example:













Done....

I hope you find it very easy and simple process.

Thank you for reading, 

Keep Sharing....Keep Growing....