• How to: Debug X++ Code Running in .NET Business Connector [AX 2012]


    This topic has not yet been rated Rate this topic

     http://msdn.microsoft.com/EN-US/library/bb190066.aspx

    Updated: December 16, 2011

    Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

    The Microsoft Dynamics AX development environment enables you to create a .NET-connected application and integrate with Microsoft Dynamics AX. By using .NET Business Connector, you can call X++ methods and access data from a .NET-connected application.

    Microsoft Dynamics AX requires that you set breakpoints through the client and the debugger. You need to enable setting break points in the client configuration, and then enable debugging in the .NET Business Connector configuration. For more information about debugger, see Microsoft Dynamics AX Debugger.

    There are two modes to debug .NET Business Connector code; interactive and non-interactive. An example of using the interactive mode is integrating Microsoft Excel with Microsoft Dynamics AX. For more information, see How to: Enable the Debugger. An example of using the non-interactive mode is integrating with Enterprise Portal. The following steps provide information to debug X++ code from the .NET-connected application using the non-interactive mode.

    Prerequisites

     

    To complete following procedures, you will need:

    • Microsoft Dynamics AX installed with a developer license file

    • Client, server and .NET Business Connector on the same computer

    • The Microsoft Dynamics AX developer is in the Windows admin group

    Procedures

     

    Bb190066.collapse_all(en-us,AX.60).gifSetting the Configuration Settings to Enable Debug

    In this section, you will set the configuration settings to enable your X++ code to be debugged from a .NET-connected application. The settings are in the Microsoft Dynamics AX Configuration and Server Configuration windows.

    To set the configuration settings

    1. From the Start menu, point to Administrative Tools and then click Microsoft Dynamics AX Configuration.

    2. Click the Manage button and then click Create configuration.

    3. Give the Configuration a name like DebugClientOption and click OK.

    4. Click the Developer tab, select Enable user breakpoints to debug code in the Business Connector or select Enable global breakpoints to debug code running in the Business Connector or client.

      NoteNote

      Breakpoints are user specific. If you set a breakpoint, only the intended session will break for that breakpoint even if other users execute that code while the breakpoint exists. A global breakpoint will break on any breakpoint for any session running on the machine.

    5. Click the Configuration Target: dropdown and select Business Connector (non-interactive use only).

    6. Click the Manage button and then click Create configuration…

    7. Give the Configuration a name like DebugNonIntOption and click OK.

    8. On the Developer tab, select Enable user breakpoints to debug code running in the Business Connector or select Enable global breakpoints to debug code running in the Business Connector or client.

    9. Click OK to apply changes and close window.

    The following steps are only required if you want to debug X++ code that runs on the AOS server, if your code is client only code, for example Business Connector or desktop client, then the following steps are not required. This can be critical in production scenarios because applying the configuration changes require re-starting the server.

    To set the configuration settings for code that runs on the AOS server

    1. From the Start menu, point to Administrative Tools and then click Microsoft Dynamics AX Server Configuration.

    2. Click the Manage button and then click Create configuration.

    3. Give the Configuration a name like DebugServerOption and click OK.

    4. On the Application Object Server tab, select Enable breakpoints to debug X++ code running on this server.

    5. Click OK to apply changes and close window. You will be prompted to restart the service.

    Bb190066.collapse_all(en-us,AX.60).gifEnabling Debug in Microsoft Dynamics AX

    The next step is to enable debug in the Microsoft Dynamics AX application.

    To enable debug in Microsoft Dynamics AX

    1. From the System administration navigation pane, click Common > Users.

    2. Click the user that you want to debug, on the Action Pane, click Options.

    3. In the Options window, click the Development link. In the Debug section, for the Debug mode field, click When Breakpoint.

    4. Click Apply and close the Option and User windows.

    Bb190066.collapse_all(en-us,AX.60).gifSetting Breakpoints in Microsoft Dynamics AX

    The following section describes how to set breakpoints in your X++ code.

    To set breakpoints in Microsoft Dynamics AX

    1. In the Application Object Tree (AOT), locate the method that you want to debug, right-click the method and click Edit.

    2. Use F9 to include a breakpoint in your X++ code. For more information about breakpoints, see Using Breakpoints.

    Bb190066.collapse_all(en-us,AX.60).gifInvoking the Breakpoints in X++

    Now that you have the configuration settings applied and Microsoft Dynamics AX enabled to break when you debug, the final step is to run the .NET-connected application. In this section you will run the application that will cause the breakpoint to occur.

    To run the application

    1. Start the .NET-connected application that uses the Microsoft.Dynamics.BusinessConnectorNet assembly. This will load the breakpoints for the current user.

    2. Click Tools > Debugger.

    3. Run the application that will cause the breakpoints to occur. When a breakpoint is encountered, Microsoft Dynamics AX will connect to an existing debugger process and displays the output in the Microsoft Dynamics AX Debugger window. For more information about how to use the Debugger, see Microsoft Dynamics AX Debugger.

    Bb190066.collapse_all(en-us,AX.60).gifDisabling the Debug Settings

    When you are finished debugging the X++ code you must disable the debug settings. The following section describes the steps to remove the breakpoints and reset the configuration settings.

    To disable the debug settings

    1. In the AOT, locate the method that you set breakpoints in, right-click the method and click Edit.

    2. Use F9 to remove a breakpoint, or use Ctrl+F9 to disable the breakpoint.

    3. Click Tools > Options.

    4. In the Options window, click the Development link. In the Debug section, for the Debug mode field, click No.

    5. Click Apply and close the Option and User windows.

    6. Set the configuration settings back to the previous configurations. From the Start menu, point to Administrative Tools and then click Microsoft Dynamics AX Configuration.

    7. Click the Configuration drop down menu and click the previous or Original configuration.

    8. In the Application Object Server Instance dropdown, select Local client.

    9. Click the Configuration drop down menu and click the previous or Original configuration.

    10. Click OK to apply changes and close window.

    11. From the Start menu, point to Administrative Tools and then click Microsoft Dynamics AX Server Configuration.

    12. Click the Configuration drop down menu and click the previous or Original configuration.

    13. Click OK to apply changes and close window.


    Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. get your copy at the MS Press Store
  • 相关阅读:
    【转】QT中添加的资源文件qrc时的路径问题小结
    【转】Qt 资源图片删除后,错误 needed by `debug/qrc_image.cpp'. Stop. 的终极解决办法
    普通类型与自定义类型之间的转化
    快速实现python c扩展模块
    关于解决python线上问题的几种有效技术
    OpenGL超级宝典笔记----渲染管线
    读python源码--对象模型
    python与c互相调用
    OpenGL超级宝典笔记----框架搭建
    python笔记(持续更新)
  • 原文地址:https://www.cnblogs.com/Fandyx/p/3977997.html
Copyright © 2020-2023  润新知