The most common scenario for a Dynamics AX developer is that you create your X++ code and objects in the Dynamics AX Client and test them in the same interactive session. In other words you start executing your new code from within the Dynamics AX Client and if necessary debug the code by putting in some breakpoints and wait for the Dynamics AX Debugger to hit them.

There are however also scenarios where the code you have developed needs to be executed in a non-interactive session, and with the release of Dynamics AX 2009 the chances to get confronted with this are much higher because the concept of Batch Jobs has changed.

Unlike earlier versions of Dynamics AX you don’t need to have in Dynamics AX 2009 a Batch Client running any more, as the AOS is now responsible for executing Batch Jobs (that support the new Batch Framework).

The important part is that the X++ code of the Server Batch Jobs is executed on the AOS in a non-interact session, and this changes also the way how you need to debug the X++ code.

The easiest way is still trying to avoid the non-interactive part, in other words trying to execute the code running in the non-interactive session in an interactive session by creating some helper/wrapper classes and calling them from the Dynamics AX Client. However sometimes the error you are facing does only occur in the non-interactive session.

You can still instrument your code (build in some logging) and evaluate the output (log), however still you can reach a point where you have no other choice than debugging the code in the non-interactive session. For those of us that have developed Enterprise Portal Web Forms in the past the concept is very similar, as here you are also dealing with a non-interactive session.

In order to do non-interactive debugging, you need to prepare your environment and make some configuration changes. I don’t want to go into too much detail what you have to do, as I found some excellent posts and just want to refer to them instead:

Once you have set up everything correctly, you might however face the issue that the Dynamics AX 2009 Debugger does not stop at your breakpoint.

This is the case when either the AOS for Server Batch Jobs or the .NET Business Connector for Enterprise Portal are running on Windows Server 2008. In this environment the Dynamics AX 2009 Debugger will never connect to your non-interactive session and so never hit any breakpoint!

There was recently the Hotfix KB962952 released for Dynamics AX 2009 SP1 that addresses this issue. If you want to debug X++ code in a non-interactive session in Dynamics AX 2009 and you are running on Windows Server 2008 you need to install this Hotfix!

Once the Dynamics AX 2009 Debugger is attached to your non-interactive session the experience you get is the same as if you would debug interactive sessions.

--author: Alexander Lachner
--editor: Alexander Lachner
--date: 23/09/2009