Debug a batch task AX 2012

Because batch tasks run in noninteractive mode and X++ executes in the common language runtime (CLR), to debug a batch task, you have to perform additional steps to configure the AOS and the Visual Studio debugger, in addition to setting up breakpoints.
First, configure the AOS for batch debugging. This is necessary for two reasons.
1-  The AOS modifies the X++ assembly to disable Just-In-Time (JIT) optimizations in the CLR. This is necessary to enable variables and object contents to be viewed and analyzed in the debugger.
2- The AOS produces source files containing the X++ code under the server Bin\XppIL\Source folder. You can open these files in Visual Studio to set breakpoints and perform common tasks, such as step ping into and step ping over.
Configure AOS for batch debuggingUse the Microsoft Dynamics AX Server Configuration Utility (see Figure below) to configure the AOS for batch debugging. The utility is available on the computer on which you installed the AOS. To do this, perform the following steps:
1. Open the Microsoft Dynamics AX Server Configuration Utility. Click Start > All Programs > Administrative Tools > Microsoft Dynamics AX 2012 Server Configuration.
2. Select the Enable Breakpoints to Debug X++ Code Running on This Server check box.
3. Click OK to close the utility, and then restart the AOS.
image
Configure Visual Studio for debugging X++ in a batch
To configure Visual Studio for batch debugging, attach to the AOS process Ax32Serv.exe by following these steps:
1. In Visual Studio, on the Debug menu, click Attach To Process.
2. When the Attach To Process dialog box opens (see Figure below), click Select to select Managed (v4.0) code, and then select the following check boxes:
              • Show Processes From All Users
              • Show Processes In All Sessions
3. Click Ax32Serv.exe, and then click Attach.
image
Clear the Enable Just My Code (Managed Only) check box, and then click OK.
After you complete these steps, you can open the X++ source code from the Bin\XppIL\Source folder on the server and set breakpoints.

No comments:

Post a Comment