Debug managed code executing on a remote AOS in AX 2012 – Bojensen Blogs
Bojensen Blogs

Debug managed code executing on a remote AOS in AX 2012

A new feature in AX 2012 is that some pieces of code are run on the server side (AOS) and are executed in managed code.

For example X++ scheduled batch jobs are compiled to common intermediate language (CIL) before beeing executed on the AOS. This is the same for services code.

 

See the following link for more information :  X++ Compiled to .NET CIL

When this code is executed, it’s sometimes pretty cool to be able to debug it.

Microsoft in his recommandations says that Visual Studio 2010 has to be installed on the AOS Server.
At first, I didn’t see this recommandation and I tried to debug on my own computer.

It definitely seems to work if you use a UNC share for the source code to be available in Visual Studio.
Here are the step I followed :

  1. Install the visual studio remote debugging 
  2. Run the remote debugger
  3. Locate the sources
  4. Launch VS 2010 on your computer
  5. Open a Method
  6. Configure the solution properties
  7. Attach to the server

1. Install the remote debugging
– Download the Visual studio 2010 remote debuggin tool
– install it on the AOS. (I’ve chosen to install it as a service but you do as you wish.)
Also be sure to check the following options on the server configuration utility :

2. Run the remote debugger
You should have the following service started  :

3. Locates the sources
– Once the complete CIL is done, X++ source files are generated. These files are needed for visual studio to show us the code. It should be placed in the following folder :

C:Program FilesMicrosoft Dynamics AX60Server<AOS_INSTANCE_FOLDER>binXppILsource
You should see thousands of .xpp files

Check you can access this folder with a share. For example : ServerNameC$Program Files …..
or create a share yourself

4. Launch Visual studio 2010
– Be sure that you selected the right configuration in your Client configuration utility, or use the switch to the command line to choose the correct AOS.
– Launch the Dynamics AX Application Explorer to browse the AOT

5. Open a method
– When you double click on a method, a new solution will automatically be created.

6. Configure the solution properties
– Right click on the solution and click on the properties menu.
– Select debug source file in the list
– add the path to the source folder (the share you created before).

7. Attach visual studio to the AOS service

You can remotely debug the AOS without any problems.

Dynamics AX Developer: AX 2012 debug managed code executing on a remote AOS

Comments are closed.