Debugging .NET Assemblies in Dynamics AX


This is my final post on debugging Dynamics AX 2009 and AX 2012. Check my previous posts to learn how to debug client, server, services, and Enterprise Portal. Debugging of .NET assemblies is not possible in Dynamics AX 2009 as it is not integrated with these libraries. To debug the. NET framework source code in AX 2012 you will need Visual Studio and. NET Reflector installed on the workstation or VM. Next, you need to configure Visual Studio:

    • Open the. NET Reflector. In the Tools menu choose Visual Studio and Windows Explorer Integration. In a dialog select the installed version of Visual Studio and click OK.
    • Open the. Net Reflector menu in Visual Studio to choose the assemblies for debugging. Select Explore Decompiled Assemblies in the same menu to set the breakpoints.
    • Now you can attach to process as I have explained here.

Important! If the. NET assembly was built by you, the system removes the debug information and it’s impossible to debug. Here is what you need to do to succeed:

    1. Close all the clients and Visual Studio, stop the AOS servers. Remove a needed assembly from GAC/
    2. Build you code in the debug mode. Get *.dll and *.pdb files and put them into the Server\.\Bin and Client\bin directories of the AX installation
    3. Open Visual Studio, select Debug> Options and Settings. Go to Debug node > General sub node and uncheck the Enable Just My Code (managed) check-box. Now go to Debug node > Symbols sub node and specify the client bin and server bin installation directories. Make sure that the server bin directory belongs to your AOS.
    4. Configure your project for debugging.

Now you can set breakpoints in X++ and in. NET and run the Visual Studio project.