Dynamics AX 中的调试

发布于 2024-08-17 05:52:00 字数 292 浏览 6 评论 0原文

我在学习过程中仍然面临一些麻烦,所以我想一旦我和大孩子一起玩,情况往往会变得更糟:动态警告不像VS那样精确和信息丰富,没有鼠标悬停提示,并且有例外情况告诉我到底哪里错了。 我只是太习惯了 Visual Studio,它是智能感知和所有工具(与 Visual Studio 相比,动态是相当新的)

除了解决简单的代码问题之外,我还想学习如何解决代码中可能出现的问题不是我写的,也不是我在 Visual Studio 中 3 分钟内解决的任何其他问题,以及有关如何在没有所有 Visual Studio 工具的情况下在 Dynamics ax 中生存的提示。

I'm facing some troubles still while learning, so I guess it tends to get worse once I play with the big kids: warnings in dynamics aren't as precise and informative as VS's, there are no mouse-over tips, and exceptions to show me exactly where I've got it wrong.
I'm just too used to Visual Studio, it's intellisense and all the tools (dynamics is quite new when compared to Visual Studio)

More than solving simple code issues, i'd like to learn how to solve upcomming ones i might have in code not written by me or anything else i'd solve in 3 minutes in Visual Studio, as well as tips on how to survive in dynamics ax without all the Visual Studio tools.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

甜妞爱困 2024-08-24 05:52:00

Dynamics AX 中的代码编辑器具有一些智能感知功能,可以键入表或类变量的名称,后跟 .或 :: 将为您提供可用于该项目的字段或方法的列表。键入 ( 开始方法调用后,会弹出一个工具提示,其中包含该方法上可用的参数。开始新行时,您可以右键单击并列出表、列出类、列表类型等。大多数命令也是可通过快捷键获取。仅当方法中直到光标位置的所有代码在语法上都正确时,智能感知才起作用。

请确保您已更新开发环境中的交叉引用(工具/开发工具/交叉引用/定期/更新)。通过更新的交叉引用,您可以右键单击 AOT 中的任何表、字段、类、方法、扩展数据类型或枚举,然后选择“加载项”/“交叉引用”/“使用者”以查看该项目在 AOT 中的使用位置。 。

您还可以使用工具/开发工具/代码资源管理器来查看应用程序的源代码,其中所有类型、变量和方法都变成了超链接,以便您可以单击以直接转到该项目的定义

另一个有用的工具是应用程序层次结构树,可以在工具/开发工具下或右键单击加载项菜单上使用。这将向您显示类层次结构,因此您可以轻松地看到,例如,SalesFormLetter 派生自 FormLetter,而 FormLetter 派生自 RunBaseBatch。

在编辑器中,您可以突出显示文本并右键单击“查找属性/方法”或“查找定义”。

如果您试图追踪系统中生成特定信息日志消息的位置,可以使用两种策略:

  1. 在第一行设置断点
    Info.add() 方法的。那么当
    您运行生成的代码
    消息,您将弹出
    信息日志一出现就进行调试
    生成的。然后你可以查看堆栈
    在调试器中跟踪以查看代码在哪里
    生成消息。

  2. 运行工具/开发
    工具/标签/标签编辑器和搜索
    对于消息的文本。选择
    消息的标签 ID,然后
    单击“使用者”查看该位置
    消息在系统中使用。

The code editor in Dynamics AX has some intellisense, typing the name of a table or class variable followed by . or :: will give you a list of fields or methods available for that item. After you type the ( to start a method call, a tooltip pops up with parameters available on that method. When starting a new line, you can right click and List Tables, List Classes, List Types, etc. Most of those commands are also available via Shortcut Keys. Note that the intellisense only works if all the code in the method up to the location of your cursor is syntactically correct.

Make sure you have updated the cross reference in your development environment (Tools/Development tools/Cross-reference/Periodic/Update). With an updated cross reference, you can right click an any table, field, class, method, extended data type, or enum in the AOT and choose Add-Ins/Cross-reference/Used by to see where that item is used in the system.

You can also use Tools/Development tools/Code explorer to view the source to the application with all types, variables, and methods turned into hyperlinks so you can click to go right to the definition of that item.

Another useful tool is Application hierarchy tree, available either under Tools/Development tools, or on the right click Add-Ins menu. This will show you the class hierarchy, so you can easily see, for example, that SalesFormLetter derives from FormLetter, which derives from RunBaseBatch.

In the editor, you can highlight text and right click to Lookup Properties/Methods or Lookup Definition.

If you are trying to track down where in the system a particular infolog message is generated there are two strategies to use:

  1. Set a breakpoint on the first line
    of the method Info.add(). Then when
    you run the code generating the
    message, you will pop into the
    debugger as soon as the infolog is
    generated. You can then look at the stack
    trace in the debugger to see where the code is that
    generated the message.

  2. Run Tools/Development
    tools/Label/Label editor and search
    for the text of the message. Select
    the Label ID of the message, then
    click Used by to see where that
    message is used in the system.

心病无药医 2024-08-24 05:52:00

还有 http://www.axassist.com/ 扩展了智能感知和许多其他扩展

There is also http://www.axassist.com/ which extends intellisense and many other extensions

凤舞天涯 2024-08-24 05:52:00

这些人所说的已经非常有趣并且有帮助

我想补充一点,在现实生活中,您可能会在 AX 中使用多个上下文。例如,在客户端中运行的代码、在服务器中运行的代码、在p代码和IL、COM集成、企业门户等中运行的代码。

我的观点是,如果你想通过调试找出答案,你必须首先了解你想要调试的代码在哪里运行。

了解这一点很重要,因为您可能必须在多个位置允许调试或授予权限。

示例:

  • Windows AD 调试用户(您自己添加)
  • 允许在客户端上调试
  • 允许在服务器上
  • 调试 如果要使用 MorphX,请禁用 IL,否则将进程附加到 VS 中。
  • 允许万维网发布服务与 EP 桌面交互。

最后一件事,您现在开始使用 axe,也许您需要使用 AX7(Dynamics 365 for Operations)。此版本的系统仅适用于 Visual Studio。它仍然是 x++,但是你拥有 VS 提供的很多东西。

What these guys said already is very interesting and helpful.

I'd like to add that within AX in real life you are probably working with multiple contexts. e.g. Code running in the client, code running in server, code running in p-code and in IL, COM integrations, Enterprise portal and so on.

My point is, if you want to figure something out through debugging, you must first understand where the code(s) you'd like to debug is running.

Knowing that is important because you might have to allow debugging or give permissions in multiple places.

Examples:

  • Windows AD debugging users (add yourself)
  • Allow debugging on client
  • Allow it on server
  • Disable IL if you want to use MorphX, otherwise attach the process in VS.
  • Allow World Wide Web Publishing Service to interact with desktop for EP.

One last thing, you are starting to work with ax right now, perhaps you will need to work with AX7(Dynamics 365 for Operations). This version of the system works only with visual studio. It is still x++, but you have a lot of the things VS provides you.

舞袖。长 2024-08-24 05:52:00

查看 EditorScripts 类,在 AX 编辑器上,您可以通过右键单击并选择“脚本”来使用它。这是一种可以自己制作的智能感知,例如:每当我输入“mycom”并按“tab”时,这是我的内嵌评论

public void template_flow_mycom(Editor editor)
    {
        xppSource   xppSource   = new xppSource(editor.columnNo());
        int         currentline = editor.currentLineNo();
        int         currentcol = editor.columnNo();

        Source      template = "//Partner comment "+date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll )+" at "+time2str(timenow(), 1, 1)+" by MAX - Begin\n";
        template+=strRep(" ", currentcol)+ "\n";
        template+=strRep(" ", currentcol)+ "//Partner comment "+date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll )+" at "+time2str(timenow(), 1, 1)+" by MAX - End\n";

        editor.insertLines(template);
        //move cursor to the empty line between the comments
        editor.gotoLine(currentline+2);
        editor.gotoCol(currentcol+4);
    }

Take a look on EditorScripts Class,On AX Editor you can use it by right click and choose "Scripts". It is a kind of intellisense that can make by your self, for example: here is my in-line comment whenever I type "mycom" and press "tab"

public void template_flow_mycom(Editor editor)
    {
        xppSource   xppSource   = new xppSource(editor.columnNo());
        int         currentline = editor.currentLineNo();
        int         currentcol = editor.columnNo();

        Source      template = "//Partner comment "+date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll )+" at "+time2str(timenow(), 1, 1)+" by MAX - Begin\n";
        template+=strRep(" ", currentcol)+ "\n";
        template+=strRep(" ", currentcol)+ "//Partner comment "+date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll )+" at "+time2str(timenow(), 1, 1)+" by MAX - End\n";

        editor.insertLines(template);
        //move cursor to the empty line between the comments
        editor.gotoLine(currentline+2);
        editor.gotoCol(currentcol+4);
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文