AX7: Quick and easy debugging
This purpose of this blog is to show how you can get quickly get started with debuggingin AX7, specifically by showing how you can debug an error message issued from AX.
So, let’s begin !
Imagine you are posting a Bank journal and you get the following error message upon posting ‘Currency EUR not allowed for account USMF OPER’
You would like to know the logic behind this error message, but need to trace in the code where it was issued from
We will use a classic debugging technique known from AX 2012 to demonstrate how this can be done quickly and easily, by inserting a breakpoint on the Info class to enable the debugger to track down in the code where the error is generated from.
These are the steps 1.Start Visual Studio as ‘Administrator’
2. Go to the Application explorer, go to the ‘Code’ node, select ‘Classes’ and locate the ‘Info’ class
On the ‘Info’ class rightclick and select ‘View code’
In the window that opens up, select the ‘Add’ method
3. Insert your breakpoint on the ‘Add’ method by pressing ‘F9’
4. Press ‘Debug’ from the toolbar and select ‘Attach to process’
In the ‘Attach to process’ screen mark ‘Show processes from all users’ and then browse to the process ‘w3wp.exe’
Wait for the Symbols to load
5. Once the symbols have loaded repeat the application procedure, eg. in this case we will post the journal again to generate the error message
And note that almost immediately the debugger starts executing in Visual Studio
I copy the call stack into Notepad and here I note especially the highlighted line as this is the line that is triggered just before the call to the Infolog code
I can see that the error is triggered on the BankAccountTable, checkCurrency method on line 225 and I stop debugging
I go to this code to study the method
I open up the BankAccountTable and similar to as on the ‘Info’ class I select ‘View Code’ and open the method I am interested in
Here naturally ‘checkCurrency’
And we can study the code that generated the error message
Naturally, you can use the same technique to insert breakpoints in other places of the code such as on ‘init’, ‘update’ and ‘insert’ methods etc
Happy debugging !
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?