Not a very creative title, right? Indeed I am not the first one to blog about this. And surely I am not going to redo the great job my fellow MVP Daniel Rimmelzwaam has done month ago. If you haven't read his post yet, you have to go out and read it. Even more: watch his video embedded in the same post. Very instructive on the various aspects of the awesome debugger we have now for NAV. If you need reasons to get moving to NAV 2013 this one should be added to your list.

And BTW: also have a look at Marq's post.

Is that what I wanted to tell you, folks? Yes ... and no. To be honest: I just wanted to share the relief I felt when I started using this debugger. The shear fact that this debugger lets me break into any NAV process from different angles. For one perspective: have a look at Daniel's video on using the break button. Or for another perspective: have a look at the following.

Setting breakpoints in your C/SIDE object on the fly

In the pre NAV 2013 era a typical nuisance would be to debug a long running process. After you have started the process, you realize you have forgotten to set one or more breakpoints. But once the process has started, you have no way to get into the debugger. Now with NAV 2013, as said, you can simply push the break button, but you can also put breakpoints into your C/SIDE object on the fly.

Let's fake a long running process with the following codeunit (56789):

OnRun()

Window.OPEN('Indicator\@1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
WHILE i < 10000 DO BEGIN
  Window.UPDATE(1,ROUND(i,1));
  i := i + 1;
  IF i = 8000 THEN
    ERROR('This is an error');
  SLEEP(5);
END

Let's run it:

Depending on the hardware you are running it on this takes some time (and if it's to fast rewrite set SLEEP to 10 or more).

OK, not to fast: don't forget to turn on the debugger (in the Development Environment choose Tools > Debugger > Debug Session to open the Session List, select your Windows Client Sessions and press the Debug button)

Now while the indicator progresses:

  1. Open codeunit 56789 in design mode
  2. Select the 3rd code line, i.e. Window.UPDATE(1,ROUND(i,1))
  3. Press F9 to set a breakpoint (i.e. the red bullet)
  4. See what happens. Almost instantly the debugger breaks at the 3rd code line.