Monday, 18 January 2016

Debugging trick number one: Info.Add()

Now and then, someone comes up to you and says “Could you take a look? There’s an error on my screen”. Mostly, it’s an infolog. And most of the time, you can double click on the message, AX will open the code editor and place the cursor on the line where the message originated.

Then, it is either very clear why the message is shown, or you can place a breakpoint to debug the problem.
But sometimes, when you double click on the message, a help window will pop up in stead of the code editor. For example when an error is thrown by the kernel. This can make it difficult to find out where exactly the problem occurs.

Luckily, for every messages that is added to the infolog, the code in the class Info, method Add() is executed. When you put a breakpoint in Info.Add(), the debugger will pop up when a message is added to the infolog, even if they originate in the kernel.

In my opinion, this is the most handy “debugging trick” in AX.

No comments:

Post a Comment