Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Debug class

Posted on by 155

Hi everyone,
could anyone tell me how to debug Class : ExchangeRateProviderCBRF_RU. 

  • Suggested answer
    Hossein.K Profile Picture
    Hossein.K 6,642 on at
    RE: Debug class

    Hi Vladislav,

    According to the documents of Microsoft:

    Debugger
    Microsoft Dynamics AX includes a powerful stand-alone debugging tool for
    X++ code. Use the Debugger to debug X++ code running on the:
    • Microsoft Dynamics AX Client
    • Microsoft Dynamics AX Object Server (AOS)


    NOTE: Managed code and X++ compiled into Intermediate Language (IL) are
    debugged using the Visual Studio debugger. This topic will be covered in the
    Visual Studio Integration chapter of the Development III course. This topic only
    covers debugging standard X++ code.
    Use the Debugger to:
    • Run a program to a certain point and then stop at a defined
    breakpoint.
    • Step through the program one statement at a time.
    • Display the call stack with code line numbers.
    • Watch specific variables and modify their values during execution.
    • Track messages being sent to the infolog.


    Debugger
    Microsoft Dynamics AX includes a powerful stand-alone debugging tool for
    X++ code. Use the Debugger to debug X++ code running on the:
    • Microsoft Dynamics AX Client
    • Microsoft Dynamics AX Object Server (AOS)
    NOTE: Managed code and X++ compiled into Intermediate Language (IL) are
    debugged using the Visual Studio debugger. This topic will be covered in the
    Visual Studio Integration chapter of the Development III course. This topic only
    covers debugging standard X++ code.
    Use the Debugger to:
    • Run a program to a certain point and then stop at a defined


    breakpoint.
    • Step through the program one statement at a time.
    • Display the call stack with code line numbers.
    • Watch specific variables and modify their values during execution.
    • Track messages being sent to the infolog.

    1423.2222.png

    To turn debugging off, you can visit Tools > Options, and select the Developer
    tab. In the Debug field, select None. When you set a breakpoint in code, this field
    will automatically be set back to When Breakpoint.


    Breakpoints are only recognized on the tiers (client or server) that have been
    configured to recognize them. Code running on the client tier will always stop at
    a breakpoint in a user's session, when the user has debugging turned on. Code
    running on the server tier will only stop at a breakpoint when the AOS has
    specifically been configured to enable breakpoints. This is a setting on the
    Microsoft Dynamics AX Server Configuration Utility.
    The Debugger can display up to six information windows. The windows display
    detailed information about the current state of the executing code while you are
    debugging. The information windows available are as follows:

    Window Description
    Code Displays the X++ code currently being debugged. The red
    dot indicates where the breakpoint is inserted. The yellow
    arrow indicates the line that is being executed. The arrow
    can be dragged to a different line of code so that code is
    either re-executed or skipped.
    Variables Displays the value of the variables. Modified variables
    appear in different colors to indicate change. Users can alter
    the value of variables in the debugger to see how the
    program would run under different conditions.
    Call Stack Indicates which method is currently being debugged.
    Double-clicking a method further down the stack will take
    the Code window to that method.
    Watch Contains a user-defined range of variables. The variables
    can be dragged and dropped from the Variables window or
    the Code window.
    Breakpoints Displays the list of currently defined breakpoints with their
    enabled status and line number.
    Output Displays separate views of text written to the window from
    X++ code and kernel code. These views organize
    information sent to the Output window.


    HINT: The Microsoft Dynamics AX Debugger Help Guide can be accessed
    directly by pressing F1 in the debugger. This guide lists keyboard shortcuts that
    make it easier and faster to use the debugger.
    Use the toolbar located above the Output window to navigate through the code
    and perform other actions.
    1423.2222.png

    Moving the pointer over these buttons reveals the button's function and a
    keyboard shortcut.
    The more generally used buttons are described in the following table, together
    with the keyboard shortcut:

    Button Keystroke Description
    Go F5 Continues the execution.
    Stop
    Debugging
    Shift + F5 Terminates the execution at the current
    line.
    Insert/Remove
    Breakpoint
    F9 Inserts or clears a breakpoint.
    Enable/Disable
    Breakpoint
    Ctrl + F9 Enables or disables a breakpoint.
    Remove all
    breakpoints
    Ctrl + Shift +
    F9
    Clears all breakpoints.
    Step Over F10 Steps to the next line of code in the
    current method.
    Step Into F11 Steps into the current line if it contains a
    method call.
    Step Out Shift + F11 Steps out of the current method.
    Run to Cursor Ctrl + F8 Continues the execution until reaching the
    location of the cursor in the Source
    window.

    By default, for performance reasons, debugging in code that is executed on the
    AOS is disabled. During development it is often required to debug this code. The
    following procedure will enable code run on the AOS to be debugged.
    1. Close the Microsoft Dynamics AX client
    2. Click Start > Administrative Tools > Microsoft Dynamics AX
    2012 Server Configuration
    3. Click Manage > Create Configuration
    4. In the Configuration Name, enter a name, for example AOS_Debug.
    5. Click OK
    6. Check the box Enable breakpoints to debug X++ code running on
    this Server
    7. Click Apply
    8. Click Yes to restart the AOS service. This may take one or two
    minutes.
    9. Click OK to close the Server Configuration Utility.
    10. Restart the Microsoft Dynamics AX client.

  • Martin Dráb Profile Picture
    Martin Dráb 228,089 Super User 2024 Season 2 on at
    RE: Debug class

    Vladislav, I already gave you the link in my first reply.

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Debug class

    Hi Vladislav!

    Check this link docs.microsoft.com/.../debugging-in-microsoft-dynamics-ax-2012

  • Vladislav Profile Picture
    Vladislav 155 on at
    RE: Debug class

    Hi Martin , the class is used in managed code (CIL). Could you tell me how to debug with Visual Studio or give me link with example. Thank you

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 228,089 Super User 2024 Season 2 on at
    RE: Debug class

    You should be able to debug it in the same way as other classes - see Debugging in Microsoft Dynamics AX 2012 if you're not familiar with it.

    Most importantly, make sure you're using the right debugger. I assume the class is used in managed code (CIL) - if it's the case, you need Visual Studio and not the X++ debugger.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans