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

april

31mar01aprTraining Class: Financial Reporting W/Account Schedules for Dynamics 365 Business Central

07apr2:00 pm2:30 pmEnsuring Quality for Batch Manufacturers

08apr11:00 am12:00 pmConfab with Stoneridge - Livestream - Jumping into the Deep End of the Data Lake

14apr10:00 am10:30 amBoost Seller Productivity and Close More Business with Dynamics 365 Sales

21apr10:00 am10:30 amSetting Your Sales Team Up for Success: A Modern Look at Revenue Operations

21apr12:00 pm1:00 pmGetting Started with Barcode Scanners and WMS Apps for Business Central

21apr2:00 pm3:00 pmMoving to the Cloud: Today's Solution for Leading Field Service Companies

22apr11:00 am12:00 pmConfab with Stoneridge - Livestream - Moving from Manual to Automated with Strategic Automation Strategies

28apr10:00 am10:30 amThe Modern Manufacturer: Best Practices for Inventory Turnover

28apr12:00 pm1:00 pmPower Up Microsoft Dynamics by Automating Budgeting, Dashboarding and Reporting

may

05may10:00 am10:30 amAchieve More with Zetadocs for Business Central

05may2:00 pm2:30 pmSimplifying Item Pricing, Availability, and Tracing for Batch Manufacturers

06may11:00 am12:00 pmD365 Field Service – New Features to Empower Your Remote Workforce

12may10:00 am10:30 amThe Modern Manufacturer: Manufacturing Software in the Real World

12may12:00 pm12:30 pmFinancial Implications of Moving from Dynamics GP to Dynamics 365: Licensing and Infrastructure

17may(may 17)8:00 am28(may 28)11:00 amDynamics 365 Finance & Supply Chain Development Training - Online Workshop

26may10:00 am10:30 amThe Modern Manufacturer - Enterprise Asset 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