Compartilhar via


Debugging Events

You can debug events to help you find and correct errors. Debugging events is similar to debugging other C/AL code in an application, where the basic concept is the breakpoint. To debug an event, you can add multiple breakpoints on event-related lines of code that cover each phase of the event, as described in the following list:

Event Phase Breakpoint Description
On publishing an event Add a breakpoint in the event publisher function that declares an event. Although an event publisher function does not contain any code, except comments, you can add a breakpoint on a non-code line.

For more information about publishing and event, see Publishing Events.
This enables you to step into the event handler code in event subscriber functions that subscribe to the event, without executing code that raises an event.
On raising an event Add a breakpoint on the line of code that calls the event publisher function which raises the event. This enables you to step into event handler code in event subscriber functions from where the events are raised.

For more information about raising an event, see Raising Events.
On subscribing to an event Add breakpoints on lines of code in the event subscriber function that subscribes to a raised event. This enables you to step through code that handles an event.

For more information about publishing and event, see Subscribing to Events.

For more information about debugging and breakpoints, see Debugging.

See Also

Events in Microsoft Dynamics NAV
Event Errors