Blog

Name is Anant Dubey and the intent to create this blog is to discuss the problems and issues that developer face in the dynamics AX development and to share the new things that come up with the new version of AX.

Thursday, May 1, 2014

How to debug Batch jobs in ax 2012

All batch jobs and service operations now run in managed code (IL) and require different debugging steps.  Rather than setting breakpoints within X++, you need to set them within the IL code that corresponds to the X++ code and debug in Visual Studio.




  1. Open AX 2012 or R2.
  2. Open Visual Studio as 'administrator' and attach the debugger to the Ax32Serv.exe process. in VS: Debug->Attach to Process.
  3.  Note that it may also be necessary to change the ‘Attach to’ selection to ‘Managed (v4.0) code’ and make sure “just my code” is unchecked in VS: tools->options->debugging->General
  4. Once done, open up the file you want to debug in Visual Studio. All of the X++ code is compiled into IL and can be found in the following directory after deployment: ..\Program Files\Microsoft Dynamics Ax\6.0\Server\AxaptaDev\Bin\XppIL\source\                                                      (NOTE:- make sure that your ax server configuration and local configuration in breakpoint enabled and in the source folder it contains all of AX classes with methods this is created when you generate CIL. If you done any modifications then you have to generate CIL).
  5. Set a breakpoint in the file you opened in Visual Studio.
  6. Go to Ax and run the process in batch mode, or execute the service operation. This will end up hitting your breakpoint, provided you set it in the right place.

No comments:

Post a Comment