Quick Modification for Tracing Bug Code in a Dynamics AX Production Environment

by | April 11, 2018 | Development, Dynamics AX

This quick modification for tracing bug code in a Dynamics AX production environment was used at a client site. I have received their permission to blog about this as I thought it was pretty useful.

Basically, the modification consists of the creation of an empty security role. When a user reports a bug, they may be asked for more detailed repro steps within the production environment. The user will be added to this security role, which will trigger the dumping of the X++ call stack into the Infolog when the error is generated. Once the repro is complete, the user is simply removed from the security role, and the logging is stopped. For the bug repro, the user may need to have running code in CIL disabled so the full call stack can be retrieved as well.

Part 1. Create an empty security role in the system

  • Navigate in the Dynamics AX 2012 client System administration > Setup > Security > Security roles
  • Click the New button
  • Fill in pertinent information

Create an empty security role in the system

  • Click the Close button

Part 2. Modify the info class, add() method

Change the method to the following code (no changes in the latter half of the method, so just make the displayed modifications:

NOTE: there is a rough stub for capturing the CIL call stack as well.

Part 3. Add the security role to the user

Within the client, navigate System Administration > Common > Users. Select the user by double-clicking, and add the security role to the user by clicking the Assign roles button

Add the security role to the user

Click the OK button once the debugging role has been selected.

Part 4. If needed, disable running business logic in CIL

In the client, navigate File > Tools > Options > Development tab. Uncheck the Execute business operations in CIL checkbox

Disable running business logic in CIL

Click the Close button.

At this point, you should be able to run a process, and see the call stack in the Infolog when the error is generated.


Once this has been captured, simply go back into the user, and remove the debugging security role from the user. If the Execute business operations in CIL checkbox was modified, go back and correct that setting as well.

I hope that you find this useful, and it provides you something you can add to your ‘bag of tricks’ for debugging or troubleshooting any Dynamics AX issues.

Related Posts


Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events


12aug10:00 am10:30 amWhy Levridge Grain? How to Achieve Efficient and Accurate Scale Tickets

12aug12:00 pm1:00 pmThe Three Paths to Dynamics 365 Finance and Supply Chain from Dynamics AX

13aug11:00 am12:00 pmConfab with Stoneridge - Livestream - Inspire Keynote Breakdown

19aug10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

19aug12:00 pm12:30 pmThe Modern Manufacturer - Death by Safety Stock

27aug12:00 pm1:00 pmConfab with Stoneridge - Livestream - Dynamics 365 2020 Wave 2 Preview


02sep10:00 am10:30 amThe Modern Manufacturer - Cycle Count Management

09sep10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

16sep10:00 am10:30 amThe Modern Manufacturer - Product Lifecycle Management

30sep10:00 am10:30 amThe Modern Manufacturer - Return Management

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!