X++ / Client Code Debugging in Dynamics AX

04/10/2014

Dynamics AX is a big and complex system and be really tricky to debug as such, as the required processes are unique for its many components. I’ve decided to make series of posts on debugging different parts of the system. I hope that this information will be useful for the experienced AX developers, as well as for the beginners, as I tried to gather all information on debugging in AX 2012 and AX 2009 at one place.

X++ / Client Code Debugging in Dynamics AX

The client code debugging is similar for both Dynamics AX 2009 and AX 2012. It is executed through the Dynamics AX debugger, which is a stand-alone application. To start debugging, you should enable the process on the client side:

    • Go to Tools > Options in the Dynamics AX client drop-down menu
    • Select the Development page, set the Debug mode field to When breakpoint

Breakpoints can be set or removed from any line using the F9 key. If the line is blank, the breakpoint will be moved to the next line, the breakpoint on the last brace of method will never be reached.

The debugger starts automatically with the start of the debugging session. However, if you use AX 2012, you can get the following error: The X++ debugger works only for users who are in the ‘Microsoft Dynamics AX Debugging Users’ local group of the Windows. You can proceed with debugging after you add a user to this group. When the breakpoint is hit, the execution stops so you can continue stepping through the code in the debugger. The source code line on which the execution has stopped is shown in the debugger. Breakpoints are saved between the sessions.

This is how you debug the client code. Next week, I will tell you all about the server debugging in Dynamics AX.