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

By Eric Meissner | December 9, 2014

Debug::assert() method causes stack trace error in dynamics ax when in debugging mode

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

Recommended Reading:

Manage U.S. Use Tax on Purchase Orders in Dynamics 365 Finance and Operations

  Managing sales tax requirements on your business purchase can be complicated, but Dynamics 365 Finance and Operations can help […]

Read the Article
5.19.22 Dynamics CRM

How to Write a Great Support Ticket in the Stoneridge Support Portal

Submitting a support ticket through the Stoneridge Support Portal is a quick and effective way to get assistance for any […]

Read the Article

Managing Your Business Through Uncertain Times Using Dynamics 365 Finance and Operations

  Dynamics 365 Finance and Operations (F&O) can help you make informed decisions on how to move your business forward. […]

Read the Article
5.13.22 Power Platform

Using Power BI Object Level Security

  The following article will demonstrate how to use Power BI Object Level Security to disable column data based on […]

Read the Article
5.12.22 Dynamics CRM

How to Use the Stoneridge Support Portal

Stoneridge Software’s support portal is an intuitive and useful function that makes it easy for you to access resources to […]

Read the Article
5.6.22 Dynamics GP

Dynamics GP Transaction Removal: Purchase Orders

  Are you having performance issues with Purchase Orders?  Do you find that there are old Purchase Orders on your […]

Read the Article
5.5.22 Dynamics GP

The Real Story about the Long-Term Future of Dynamics GP Support

I’ve seen a number of people put forward comment that Dynamics GP is going away and you have to get […]

Read the Article

New Features in Dynamics 365 Business Central 2022 Wave 1 Release – Financial Enhancements

The Dynamics 365 Businses Central 2022 Wave 1 Release has a lot of new and exciting features to help your […]

Read the Article
4.29.22 Dynamics GP

Dynamics GP Transaction Removals: Bank Reconciliation

  This is part 2 of a 3 part series on Dynamics GP Transaction Removals. These quick tips will hopefully […]

Read the Article

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X