Debug::Assert() Method Causes Stack Trace Error in Dynamics AX When in Debugging Mode

by | Updated August 15, 2016 | Development, Dynamics AX

I recently encountered a  scenario of users getting a stack trace error when trying to generate an invoice while in debugging mode in Dynamics AX. When working through bugs on the test server, calling the Debug::assert()  caused the stack trace error to appear.

Problem:  User getting stack trace error when trying to generate an Invoice.

 

 Infolog in Dynamics AX

Cause:  Since we were working through a lot of bugs, the testers were finding we had to have debugging enabled on the test server. When the process hits this:  Debug::assert() code, the AX debugger was invoked automatically, displaying the stack trace error.  The user would never get this error in production because the debugging would be disabled.

 

Reproducing Error:  I had issues trying to reproduce this error in our development environment.  When the error occurred it never hit a break point in the debugger so I couldn’t find the line of code that was generating the error.  After some research I found out that I had to check the ‘Execute business operations in CIL’ (Tools – Options – Development form).  After checking I was able to do more debugging in AX and Visual Studio to find where the error was being generated, when trying to call Debug::assert(). 

 Options in AX 2012

 

 

How to Resolve Debug::assert() error:  To eliminate this error during our testing the change was simple.  First make sure that ‘Execute business operations in CIL’ is checked.  NOTE:  after checking/unchecking this you have to generate a CIL before you will see the changes in VS.  Then you need to find the Debug::assert() that is causing the error.  When you find comment out the line but make sure to put a TODO statement to make sure to uncomment the code before the move to production.  For example, //TODO uncomment Debug::assert when debugging is turned off.  This TODO will come up when you do a compile within AX.  The downside to this is that I did have to make a change to a SYS layer class/method.  However, once you remove the commented line and TODO you can do a Compare and delete the VAR layer since there are no longer any code changes.

 

 Classes Vend Doclument Line Type

 

This issue took a bit for me to work through.  Hopefully these steps can save someone time in the future.  Happy debugging.

 

 

 

 

Related Posts

0 Comments

Submit a Comment

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

Upcoming Events

october

07oct12:00 pm1:00 pmThe Three Paths to Business Central from Dynamics GP

08oct11:00 am12:00 pmConfab with Stoneridge - Livestream - The Vision and Strategy of Microsoft Business Systems

14oct10:00 am10:30 amThe Modern Manufacturer - Managing Complex Cost Modeling

14oct12:00 pm12:30 pmGenerating Custom Inspection or Process Forms

19octAll Day22Stoneridge Connect Fall 2020

22oct11:00 am12:00 pmConfab with Stoneridge - Livestream - Stoneridge Connect Recap

28oct10:00 am10:30 amThe Modern Manufacturer - Engineering Change Management: Introduction of NEW Functionality for Manufacturers Using Dynamics 365

november

11nov10:00 am10:30 amThe Modern Manufacturer - Tears and Trauma of MRP

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!

X