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. 

  • Martin Dráb Profile Picture
    231,748 Most Valuable Professional on at
    RE: xSession::xppCallStack() is not containing the root object details from where the error is triggered

    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.

  • WillWU Profile Picture
    22,352 on at
    RE: xSession::xppCallStack() is not containing the root object details from where the error is triggered

    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

  • Suggested answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: xSession::xppCallStack() is not containing the root object details from where the error is triggered

    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.

  • Community Member Profile Picture
    on at
    RE: xSession::xppCallStack() is not containing the root object details from where the error is triggered

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

    pastedimage1606380759387v1.png

  • nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: xSession::xppCallStack() is not containing the root object details from where the error is triggered

    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
    RE: xSession::xppCallStack() is not containing the root object details from where the error is triggered

    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,156 Moderator on at
    RE: xSession::xppCallStack() is not containing the root object details from where the error is triggered

    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
    RE: xSession::xppCallStack() is not containing the root object details from where the error is triggered

    I guess, now you will be able to see it

  • nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: xSession::xppCallStack() is not containing the root object details from where the error is triggered

    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".

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,748 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans