Walkthrough: Debugging a Batch that Runs on the AOS

From the client, you can schedule a batch to run on the Application Object Server (AOS). You can run the debugger on the client computer, and you can use the debugger to debug the batch as the batch runs on the AOS. Debugging from your own client computer is typically more convenient than gaining direct access to the AOS computer.

This walkthrough illustrates the following tasks:

  • Configuring the AOS

  • Configuring the client

  • Running the AxDebug.exe debugger on the client computer

  • Using MorphX to set a breakpoint

  • Using the Content Pane to implicitly schedule a batch for the AOS

  • Monitoring the debugger as it pauses on the breakpoint

Prerequisites

To complete this walkthrough, you need:

  • Microsoft Dynamics AX

  • A license file that has access to the MorphX development environment

  • The ability to schedule a batch to run on the AOS

    Note

    For more information about how to run a batch on the AOS, see "Create a batch job" in the Help menu Application and Business Processes.


Configuring the AOS

In this procedure, you run the server configuration utility on the server computer. You use the utility to enable breakpoints on the AOS.

To configure the AOS

  1. In Microsoft Windows, click the start menu, click All Programs, click Administrative Tools, and then click the line for Microsoft Dynamics AXServer Configuration. A window for the utility is displayed.

  2. Select the check boxes for the following:

    • Enable breakpoints to debug X++ code running on this server

    • Enable global breakpoints to debug X++ code running in batch jobs

    Note

    If the check boxes are unavailable, and they are not selected, you must first create a new configuration. To do this you click the Manage button, and then click Create configuration.


  3. Click the OK button to close the utility.

Configuring the Client

In this procedure, you run the client configuration utility on the client computer. You use the utility to enable breakpoints on the client.

To configure the client

  1. In Microsoft Windows, click the start menu, click All Programs, click Administrative Tools, and then click the line for Microsoft Dynamics AXConfiguration (the line might not specify server versus client). A window for the utility is displayed.

  2. Select the check box for the following:

    • Enable global breakpoints to debug code running in the Business Connector or client
  3. Click the OK button to close the utility.

Running AxDebug.exe on the Client Computer

In this procedure, you run the AxDebug.exe program on the client computer.

To run the AxDebug.exe on the client computer

  1. In Windows Explorer, locate the Client\Bin\ directory of your Microsoft Dynamics AX installation.

    Tip

    The full path varies between installations. One common path is C:\Program Files\Microsoft Dynamics AX\50\Client\Bin\ where 50\ represents a product version (in this case Microsoft Dynamics AX 2009).


  2. Double-click the AxDebug.exe program to run it.

Using MorphX to Set a Breakpoint

In this procedure, you use the Application Object Tree (AOT) and MorphX in the client to set a breakpoint in a method. The AxDebug.exe debugger was started in an earlier procedure and is still running (waiting for a breakpoint to be reached). Yet you set the breakpoint in MorphX. Later when the breakpoint is reached in the running batch, the code for the method will display in the debugger application.

To use MorphX to set a breakpoint

  1. In the AOT, expand the Classes node, expand ProdTableCleanUp, right-click the run method node, and then click Edit.

  2. In the code editor window, click the line that calls this.validate(), and then press F9. The line becomes highlighted to indicate the breakpoint is set.

Using the Content Pane to Implicitly Schedule a Batch for the AOS

In this procedure, you use the Content Pane to delete old completed records from the various production order tables (including ProdTable). This Content Pane option operates by scheduling a batch that runs on the AOS. The batch uses the ProdTableCleanUp.run method in which you have set a breakpoint.

To use the Content Pane to implicitly schedule a batch for the AOS

  1. In the client, in the Content Pane for the Production module, in the Periodic area, expand the Clean up node, and then click Production orders clean up. A Delete productions form is displayed.

  2. In the form, click the Batch tab, and then click the Batch processing check box.

  3. Click the OK button. After a brief delay, the Infolog is displayed with a message indicating that the batch has been added to the queue.The batch will likely start in 2-3 minutes.

Monitoring the Debugger as it Pauses on the Breakpoint

In this procedure, you can monitor the scheduled batch to see when it starts. After you see the batch start, the AxDebug.exe debugger should pause at the breakpoint.

To monitor the debugger as it pauses on the breakpoint

  1. In the client, in the Content Pane for the Basic module, in the Inquiries area, click the Batch job link. A Batch job form is displayed.

  2. In the form there is a line item for the Delete productions batch.

  3. After the Status of the batch line item changes to Executing, switch to the debugger application to verify that processing has paused at the breakpoint.

Next Steps

To continue to debug, use the step-into and step-over actions in the AxDebug.exe application window. When the batch is completed, the debugger loses its connection to the server process.

See Also

Microsoft Dynamics AX Debugger