Debugger
The debugger is a stand-alone application, not part of the Dynamics AX shell like the rest of the tools . As a stand-alone application, the debugger allows you to debug X++ in any of the Dynamics AX components in the following list:
Microsoft Dynamics AX client :
Click the Microsoft Dynamics AX drop-down menu, point to Tools and then Options. On the Development tab, select When Breakpoint in the Debug Mode list.
Application Object Server (AOS) :
Open the Microsoft Dynamics AX Server Configuration utility under Start\Administrative Tools. Create a new configuration (if necessary), and select the check box labeled Enable Breakpoints To Debug X++ Code Running On This Server.
For Batch jobs, open the Microsoft Dynamics AX Server Configuration utility under Start\Administrative Tools. Create a new configuration (if necessary), and select the check box labeled Enable Global Breakpoints To Debug X++ Code Running In Batch Jobs.
Enterprise Portal and Business Connector:
Open the Microsoft Dynamics AX Configuration utility under Start\Administrative Tools. Select one of two check boxes on the Developer tab: Enable User Breakpoints For Debugging Code Running In The Business Connector or Enable Global Breakpoints For Debugging Code Running In The Business Connector Or Client. The latter is useful for debugging incoming Web requests.
Note : Do not enable any of the debugging capabilities in a live environment. If we do, execution will stop when it hits a breakpoint, and users will experience a hanging client.
By pressing F9 we can set or remove " Breakpoint ".
You can enable or disable a breakpoint by pressing Ctrl+F9. For a list of all breakpoints, press Shift+F9.
Debugger Interface
The main window in the debugger initially shows the point in the code where a breakpoint was hit. We can control execution one step at a time while variables and other aspects are inspected. Figure 1 shows the debugger opened to a breakpoint with all the windows enabled.
Figure 1. Debugger with all windows enabled
In the following subsections, we briefly describe the debugger’s various windows and some of its other features.
Main Window :
The main debugger window shows the current X++ code. Each variable has a ScreenTip that reveals its value. You can drag the next-statement pointer in the left margin. This pointer is particularly useful if the execution path isn’t what you expected or if you want to repeat a step.
Variables Window :
In this window, local, global, and member variables are shown. Local variables are variables in scope at the current execution point. Global variables are the global classes that are always instantiated: Appl,Infolog, ClassFactory, and VersionControl. Member variables make sense only on classes, and they show the class member variables.
The Variables window shows the name, value, and type of each variable. If a variable is changed during execution stepping, it is marked in red. Each variable is shown associated with a client or server icon. You can modify the value of a variable by double-clicking the value.
Tip : As a developer, we might want to provide more information in the value field than what is provided by default. For a class, the defaults are New and Null. You can change the defaults by overriding the toString method. If your class doesn’t explicitly extend object (the base class of all classes), you must add a new method named toString, returning str and taking no parameters, to implement this functionality.
Call Stack Window :
The Call Stack window shows the code path followed to arrive at a particular execution point. Clicking a line in the Call Stack window opens the code in the Code window and updates the local Variables window. A client or server icon indicates the tier on which the code is executed.
Watch Window :
In the Watch window, you can inspect variables without the scope limitations of the Variables window. You can drag a variable here from the Code window or the Variables window.
The Watch window shows the name, value, and type of the variables. Five different Watch windows are available. You can use these to group the variables you’re watching in the way that you prefer.
Breakpoints Window :
The Breakpoints window lists all your breakpoints. You can delete, enable, and disable the breakpoints via this window.
Output Window :
The Output window shows the traces that are enabled and the output sent to the Infolog application framework. The Output window includes the following pages:
-
-
-
Status Bar :
-
-
-
-
Debugger Shortcut Keys
Table lists the most important shortcut keys available in the debugger.
Figure 1. Debugger with all windows enabled
Tip : As a developer, we might want to provide more information in the value field than what is provided by default. For a class, the defaults are New and Null. You can change the defaults by overriding the toString method. If your class doesn’t explicitly extend object (the base class of all classes), you must add a new method named toString, returning str and taking no parameters, to implement this functionality.
Call Stack Window :
|
1 comment:
The information which you have provided in this blog is really useful to everyone. Thanks for sharing.
Microsoft Dynamics AX Training
MS Dynamics AX Training
MS Dynamics Training in Hyderabad
Microsoft Dynamics AX Technical Training
Microsoft Dynamics AX Technical Training in Hyderabad
Post a Comment