Wednesday, June 10, 2015

Debugger in AX 2012

Debugger in AX 2012




     When you execute the job, it will stop at your breakpoint and it will look like the above screenshot. There are two ways of break point.


  1.        Hard coding with command.(Breakpoint;)
  2.        Using F9 or clicking on red bullet on task bar or left grey bar in X++ code editor.

   Generally it consists of 6 windows:  
   

  1.  Code: it displays the code. It looks like read only display of X++ code editor.
  2. Variables(Ctrl+Atl+V): You can find three types of variable values in this window. Locals – Shows current execution scope. Globals –  Shows Global variables values like ClassFactory, Appl and more. This –shows the class member variables
  3.  Call stack (Ctrl+Alt+C): it displays the stack of methods that were executed to reach break point.
  4.  Watch (Ctrl+Alt+W): You can add variables to watch their behavior in this window.
  5.  Breakpoints(Ctrl+Alt+B): It lists all the breakpoints which are placed in your user session.
  6.  Output(Ctrl+Alt+O):  it displays multiple outputs. Mainly used tab is infolog. Debug – Its another flavor of infolog to see messages only on debugger but not on infolog. Following code will trigger this tab. Debug::printDebug("Khalid Mohammed"); Infolog –  No explanation needed. All All other tabs:  They are optional and can be trigerred by setting preferences in Tools>Options.

   Now to main functions of debuggers:[1]


  1.   Step over (F10): Using this operation, you can execute the current line without debugging methods called by the statement if any.  
  2.   Step into (F11): Using this operation, you can step into the method called by the current line. If more than one method is called, the innermost method will have priority, then the first one to the left of the line, and then the one towards the right.
  3.   Step out (Shift+F11): Using this operation, you can step out of the current method and go back to the caller method (the previous method in the stack).
  4.   Go back: You can drag the yellow arrow to a previous line of code in the current method to go back to it. Remember that the variables will not be automatically reset to the state they had when that line was executed the first time.
  5.   Run (F5): Using this operation, you can continue the execution and jump to the next breakpoint, if any.
  6.   Run to cursor (Ctrl+F10): Using this operation, you can continue to execute and break at the line where the cursor is in the code window.
  7.   Stop debugging (Shift+F5): Using this operation, you can stop executing the code; none of the lines after the current execution position will be executed.

[1]Referred from Learning MS Dynamics AX 2012 Programming – Mohammed Rasheed

No comments:

Post a Comment