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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX 2012 R3. How to debug event handlers (delegates)

(0) ShareShare
ReportReport
Posted on by 3,023

Can anyone help me to understand how to identify what X++ event handlers are subscribed to a delegate?


For example, by pure luck, I know that when posting a product receipt, when delegate \Classes\SubledgerJournalizer\recordedSubledgerJournalAccountEntries is called, the code in \Classes\SubledgerJournalizerLedgerVoucherExt\recordedSubledgerEntriesEventHandler is executed. This is because I read in some other forum post.

However, when I place a breakpoint in some other delegate, for example, I can put a breakpoint in delegate \Classes\SubledgerJournalizer\insertingDistributedTmp, but how can I identify what event handler is going to be executed???

Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    When you step into your delegate in debugger, press Step Into (F11) again. Don't worry that you stay on the delegate header and there is no other code; you'll get into infrastructure classes handling events and ultimately to the event handler itself.

    When you get familiar with it, you can put breakpoints to more specific places, so you don't have to step through all calls.

  • Ghetz Profile Picture
    3,023 on at

    Indeed, this was what I was trying. However, finally I realized that sometimes a delegate is called, but there is no subscribed event handler, so no aditional code is executed.

    I shall add that once you press F11 in the delegate method and enter the infrastructure classes, you will find this variables:

    xppEvent.numDynamicEventHandlers

    xppEvent.numEventHandlers

    This are integer variables that will tell you the number of currently subscribed event handlers for this delegate. If both are 0, it means there are no event handlers to be executed.

  • Daniel Weichsel Profile Picture
    on at

    Another tip to see if there are any subscribed handlers is to peek at the $$eventMap member of the class object in the debugger.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans