web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

xSession::xppCallStack() is not containing the root object details from where the error is triggered

(0) ShareShare
ReportReport
Posted on by

In our system we have customized a framework which captures the errors and warnings infolog details of the current user session into a log.

pastedimage1606375848637v1.png

This framework workds fine for other cases, but in the above case there isn't any information about from which form this error is getting triggered and it is not recorded in the callstack too.

Here is how we are capturong the callstack into the table field.

xxxGlobalInfologsErrors.ObjectType        = con2Str(xSession::xppCallStack());

Do you guys have any idea to capture the root object details from where the error is getting triggered. 

I have the same question (0)
  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Hi 8tejaskumar,

    unfortunately your screenshot is so small that I can't see any details. So it's not clear what you mean by "the above case".

  • Community Member Profile Picture
    on at

    I guess, now you will be able to see it

  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Thanks. Basically you get the "root object details" since it's a FormRun object. All forms are FormRun objects.

    But you would like to somehow capture the name of the form.

    Could you share more details about your code that captures these exceptions? How is it triggered?

  • Community Member Profile Picture
    on at

    we have added below piece of code in info class's add method

    select firstOnly sysClientSession where sysClientSession.Status == 1;

       if(sysClientSession)

       {        

           if(_exception == Exception::Error || _exception == Exception::Warning)

           {

               customclass::captureInfolog(_exception, _txt, _helpUrl);

           }

       }

    in the captureinflog method we are inserting the values into the log table like below

    xxxGlobalInfologsErrors.ObjectType        = con2Str(xSession::xppCallStack());

  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Thanks for the details.

    Could you try one thing. If you throw exception from a form via x++, do you then see the form name in the call stack?

  • Community Member Profile Picture
    on at

    yes, we were able to capture the form name in call stack for other error cases...Below is one such example.

    pastedimage1606380759387v1.png

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Ok,

    I guess that when the exception happens in the initialization of the form, then you can't get the form name via the call stack. And I'm not aware how else you could get it.

  • WillWU Profile Picture
    22,363 on at

    Hi Tejas Kumar,

    Agree with Nikolaos, you may not get the form name from the call stack.

    community.dynamics.com/.../get-ms-dynamics-ax-call-stack-in-x-code

  • Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at

    Whether you see the form in the call stacks depends on whether it was the form who raised the exception.

    In your second example, an exception is thrown by the form (a method overriden in the form).

    In the first example, the form doesn't throw anything. The form returns control to the kernel class (SysSetupFormRun) and it's this class who throws an exception. Therefore what you see is the correct stack trace.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 490 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 241 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans