Skip to main content
Dynamics 365
  • 1 min read

How to Send the Callstack to the Infolog


When troubleshooting a problem it is helpful to have the X++ callstack especially in scenarios where you cannot use the debugger in the environment or the issue happens sporadically. The following X++ code will retrieve the X++ callstack and send it to the infolog.  Add the example code to a method that is throwing an error or that you are otherwise concerned with.  Once you have finished troubleshooting the issue make sure you remove the example code from the existing X++ method.

container myCallStack;
int i;
str whatToWrite;

;

myCallStack = xSession::xppCallStack();
for(i=1; i<=conlen(myCallStack); i++)
{
    whatToWrite += conpeek(myCallStack, i);
}

info(whatToWrite);

Get started with Dynamics 365

Drive more efficiency, reduce costs, and create a hyperconnected business that links people, data, and processes across your organization—enabling every team to quickly adapt and innovate.