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

august

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

27aug11:00 am12:00 pmConfab with Stoneridge - Livestream - Dynamics 365 2020 Wave 2 Preview

september

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!

X