Home > Sample chapters

The MorphX Development Environment and Tools


Like most development environments, MorphX features a debugger. The debugger is a stand-alone application, not part of the AX 2012 shell like the rest of the tools mentioned in this chapter. As a stand-alone application, the debugger allows you to debug X++ in any of the following AX 2012 components:

  • AX 2012 client
  • AOS
  • Business Connector (BC.NET)

For other debugging scenarios, such as web services, Microsoft SQL Server Reporting Services (SSRS) reports, and Enterprise Portal web client, see Chapter 3, “AX 2012 and .NET.”

Enabling debugging

For the debugger to start, a breakpoint must be hit when X++ code is executed. You set breakpoints by using the X++ code editor in the Development Workspace. The debugger starts automatically when any component hits a breakpoint.

You must enable debugging for each component as follows:

  • In the Development Workspace, on the Tools menu, click Options > Development > Debug, and then select When Breakpoint in the Debug Mode list.
  • From the AOS, open the Microsoft Dynamics AX Server Configuration Utility under Start > Administrative Tools > Microsoft Dynamics AX 2012 Server Configuration. Create a new configuration, if necessary, and then select the check box Enable Breakpoints to debug X++ code running on this server.
  • For Enterprise Portal code that uses the BCPROXY context to run interpreted X++ code, in the Microsoft Dynamics AX Server Configuration Utility, create a new configuration, if necessary, and select the check box Enable Global Breakpoints.

Ensure that you are a member of the local Windows security group named Microsoft Dynamics AX Debugging Users. This is normally ensured by using setup, but if you did not set up AX 2012 by using your current account, you need to do this manually through Edit Local Users And Groups in Windows Control Panel. This is necessary to prohibit unauthorized debugging, which could expose sensitive data, provide a security risk, or impose unplanned service disruptions.

To set or remove breakpoints, press F9. You can set a breakpoint on any line you want. If you set a breakpoint on a line without an X++ statement, however, the breakpoint will be triggered on the next X++ statement in the method. A breakpoint on the last brace will never be hit.

To enable or disable a breakpoint, press Ctrl+F9. For a list of all breakpoints, press Shift+F9.

Breakpoints are persisted in the SysBreakpoints and SysBreakpointLists database tables. Each developer has his or her own set of breakpoints. This means that your breakpoints are not cleared when you close AX 2012 and that other AX 2012 components can access them and break where you want them to.

Debugger user interface

The main window in the debugger initially shows the point in the code where a breakpoint was hit. You can control execution one step at a time while inspecting variables and other aspects of the code. Figure 2-17 shows the debugger opened to a breakpoint with all the windows enabled.


FIGURE 2-17 Debugger with all windows enabled.

Table 2-6 describes the debugger’s various windows and some of its other features.

TABLE 2-6 Debugger user interface elements.

Debugger element


Code window

Shows the current X++ code.

Each variable has a ScreenTip that reveals its value. You can drag the next-statement pointer in the left margin. This pointer is particularly useful if the execution path isn’t what you expected or if you want to repeat a step.

Variables window

Shows local, global, and member variables, along with their names, values, and types. Local variables are variables in scope at the current execution point. Global variables are variables on global classes that are always instantiated: Appl, Infolog, ClassFactory, and VersionControl.

Member variables are shown on classes.

If a variable is changed as you step through execution, it is marked in red. Each variable is associated with a client or server icon. You can modify the value of a variable by double-clicking the value.

Call Stack window

Shows the code path followed to arrive at a particular execution point.

Clicking a line in the Call Stack window opens the code in the Code window and updates the local Variables window. A client or server icon indicates the tier on which the code is executed.

Watch window

Shows the name, value, and type of the variables. Five different Watch windows are available. You can use these to group the variables you’re watching in the way that you prefer.

You can use this window to inspect variables without the scope limitations of the Variables window. You can drag a variable here from the Code window or the Variables window.

Breakpoints window

Lists all your breakpoints. You can delete, enable, and disable the breakpoints through this window.

Output window

Shows the traces that are enabled and the output that is sent to the Infolog application framework, which is introduced in Chapter 5, "Designing the user experience". The Output window has the following views:

  • Debug You can instrument your X++ code to trace to this page by using the printDebug static method on the Debug class.
  • Infolog This page contains messages in the queue for the Infolog.
  • Database, Client/Server, and ActiveX Trace Any traces enabled on the Development tab in the Options form appear on these pages.

Status bar window

Provides the following important context information:

  • Current user The ID of the user who is logged on to the system. This information is especially useful when you are debugging incoming web requests.
  • Current session The ID of the session on the AOS.
  • Current company accounts The ID of the current company accounts.
  • Transaction level The current transaction level. When this level reaches zero, the transaction is committed.

Debugger shortcut keys

Table 2-7 lists the most important shortcut keys available in the debugger.

TABLE 2-7 Debugger shortcut keys.






Continue execution.

Stop debugging


Break execution.

Step over


Step over the next statement.

Run to cursor


Continue execution but break at the cursor's position.

Step into


Step into the next statement.

Step out


Step out of the method.

Toggle breakpoint


Insert or remove a breakpoint.

Variables window


Open or close the Variables window.

Call Stack window


Open or close the Call Stack window.

Watch window


Open or close the Watch window.

Breakpoints window


Open or close the Breakpoints window.

Output window


Open or close the Output window.

Related resources

There are currently no related titles.