169
In the old development environment, the debugger could be attached to any instance, or selectively to the next started instance. This was very useful. Currently it seems it is not possible in D365 Business Central.

If something unexpectedly goes wrong in a customer’s production environment, we must be able to trace the origin of the error, to be able to fix it. Bugs are sometimes environment, data or user sensitive, and very difficult to reproduce. If we cannot debug a specific instance of BC, we might be unable to help our customer, or it may take a tremendous amount of unnecessary work.
Category: Development
STATUS DETAILS
Completed
Ideas Administrator

Thank you for your feedback. We have been viewing this Idea mostly as enabling debug-like capabilities in production, given that there is another idea on session attach https://experience.dynamics.com/ideas/idea/?ideaid=332d9081-da6b-e911-b047-0003ff688f46, but these two are really quite closely related (as it is normally a user session in prod), and we are addressing both in 2020 Wave 2.

For troubleshooting in the production environment, we are introducing something called snapshot debug. With this, you can insert snappoints in AL code in the Visual Studio Code debugger, attach to a production tenant, perform a repro, and capture a snapshot. Then you can download the snapshot and then offline inspect call stack trace for the whole flow and variables for the snappoints in the context of AL code in Visual Studio Code.

Snapshots will support attaching to a specific user session, as tracked by above mentioned idea, as well as web client, web API and background session (not system sessions though).

Snapshots are discrete points in time and thus, typically, several roundtrips of taking snapshots could be required (as snapshots are not taken interactively as in normal debugging, but require a new user flow recording when new snappoints are added). Sandbox environments will still be required to set actual breakpoints (stopping program execution in the session) and stepping through code.

Upon 2020 Wave 2 launch, above snapshot feature will only be available as a preview and in sandbox environments though (current ETA for sandbox end of October). Here the value will be less than the normal debugger, except providing the ability to attach to a specific session. Once thorough testing "in the wild", it is expected to be enabled for production environments in one of the first minors.

Best regards,
Business Central Team