Placing breakpoints

A breakpoint is an intentional stop or pause placed in an object. It is a mark that you can set on a statement. When the program flow reaches the statement, the debugger intervenes and suspends execution until you instruct it to continue. During the interruption, you can inspect the environment or start a line-by-line code execution.

There are several ways of placing and removing breakpoints. This section will show you all the different ways so that you can choose the one that best suits your debugging needs.

From the Object Designer

From the Microsoft Dynamics NAV Development Environment, select Table 270 Bank Account and click on the Design button to open the Table Designer window. Then press F9 or click on View, C/AL Code to open the C/AL Editor.

Place the cursor on one statement, a line of code, and press F9. A red bullet will appear on the left-hand side of the statement, as seen in the following screenshot. Press F9 again; the bullet is now a white bullet. Press F9 again and the bullet disappears; you have removed the breakpoint.

From the Object Designer

The red bullet indicates that a breakpoint is enabled for that statement. The debugger will stop when the program flow reaches that statement.

The white bullet indicates that a breakpoint was placed before, but it is now disabled. This means that the debugger will not stop on that statement.

In the current statement of the debugger

With the debugger on, place the cursor on a line of code and press F9. A red bullet will appear on the left-hand side of the statement. Press F9 again; the bullet is now a white bullet. Press F9 again and the bullet disappears. You have now removed the breakpoint.

Instead of pressing F9, you can also use the Toggle icon found on the ribbon bar, as shown in the following screenshot:

In the current statement of the debugger

Red and white bullets indicate the same breakpoints as explained in the last section. This means that you can place breakpoints from the Object Designer window or from the debugger with the same effect.

The only difference is that breakpoints placed from the Object Designer window are seen from the debugger, but breakpoints placed from the debugger cannot be seen from the Object Designer window.

The end of each function contains a blank statement where you can also place a breakpoint. If you do so, the execution flow will stop right after all the code on the function has been executed and right before returning to the calling function. This is something we could not do in the previous versions of Dynamics NAV.

Conditional breakpoint

You can place a conditional breakpoint in Dynamics NAV. The debugger will only stop the execution if the program flow reaches the breakpoint and the condition is true. Otherwise, the execution continues.

The condition can include any variables or fields that are currently in scope of the following types: BigInteger, Boolean, Code, Decimal, Integer, Option, Text, and WideText.

Place the cursor on the statement where you want to place the conditional breakpoint and then click on the Set/Clear Condition icon found on the ribbon bar. The following page will now open:

Conditional breakpoint

Write your condition using any of the supported operators: =, <>, <, >, <=, and >=. Then click on OK to go back to the debugger.

On the left-hand side of the statement, a red bullet with a white cross inside will appear. This indicates that the statement has a conditional breakpoint.

Debugger Breakpoint List

From the debugger breakpoint, you can view, set, enable, disable, or delete breakpoints. You can also set, modify, or delete conditions for the breakpoints.

From the Debugger page, click on the Breakpoints icon found on the ribbon bar to open the Debugger Breakpoint List window, as shown in the following screenshot:

Debugger Breakpoint List

On the ribbon pane of the page, you will find options to create new breakpoints and to enable or disable the existing ones. You can also modify the Condition column of any existing breakpoint.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.112.220