Setting breakpoints
Stepping through the code line-by-line or function-by-function can take forever. Luckily, there is an easy way to tell the debugger to stop right where we want it to.
How to do it...
Create and save the same codeunit discussed in the Using the debugger recipe in this chapter.
Design the codeunit.
Go to the following line of code in the
OnRun
trigger:ChangeCustomerName(Text001);
Press F9 twice.
Then go to the following line of code in the
OnRun
trigger:VALIDATE("Post Code");
Press F9 once.
Your window should look like the following screenshot:
Save and close the codeunit.
From the Tools menu of the Microsoft Dynamics NAV Development Environment page, navigate to Debugger | Debug Session (Shift + Ctrl + F11).
From the debugger window, select the user session and click on Debug (Ctrl + Shift + S) to activate the debugger.
On execution of the codeunit, the system will take you to the debugging window; the debugging screen should be identical to the following screenshot: