No debugging possible after an event (NAV2017)

Peter_KuiperPeter_Kuiper Member Posts: 19
I have a big problem with debugging in NAV2017, after an event has been invoked.
Please have a look at the following code.
OBJECT Codeunit 99999 Test Error After Event
{
  OBJECT-PROPERTIES
  {
    Date=02-05-19;
    Time=16:04:13;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    OnRun=BEGIN
            publisher();

            ItemTmp."No." := '1';
            ItemTmp.INSERT;

            MESSAGE('after first insert');

            ItemTmp.INSERT;
          END;

  }
  CODE
  {
    VAR
      ItemTmp@150002000 : TEMPORARY Record 27;

    [Integration]
    LOCAL PROCEDURE publisher@150002000();
    BEGIN
    END;

    [EventSubscriber(Codeunit,99999,publisher)]
    LOCAL PROCEDURE subscriber@150002001();
    BEGIN
      SLEEP(1);
    END;

    BEGIN
    END.
  }
}

OBJECT Page 99999 Test Page
{
  OBJECT-PROPERTIES
  {
    Date=02-05-19;
    Time=15:51:53;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    ActionList=ACTIONS
    {
      { 150002000;   ;ActionContainer;
                      ActionContainerType=ActionItems }
      { 150002001;1  ;Action    ;
                      Name=Run Codeunit 99999;
                      Promoted=Yes;
                      OnAction=VAR
                                 TestErrorAfterEvent@150002000 : Codeunit 99999;
                               BEGIN
                                 TestErrorAfterEvent.RUN;
                               END;
                                }
    }
  }
  CONTROLS
  {
  }
  CODE
  {

    BEGIN
    END.
  }
}

First I call an integration event, and after that there is a programming error. The second INSERT gives an error. The page is just there to run the codeunit.
When I put a breakpoint before the publisher, I see the following behavior:
- The debugger doesn't step into the subscriber. It executes the code, but it doesn't show me in the debugger. This is very annoying and time consuming while debugging an issue.
- Even worse than above: the debugger doesn't stop at the second INSERT! I do get the MESSAGE ('after first insert') and an error at the second INSERT, but I cannot use the debugger to find the problematic line in the code.
- F11 (Step into) doesn't work either. The debugger doesn't work at all anymore after the event.
- The debugger gives a fatal error. Sometimes I cannot start the debugger anymore, and have to restart the NAV service.
- If I put the first line in comment (e.g. //publisher(); ), then the debugger works as expected

Does anyone has experience with this behavior, and is there a solution?

Comments

  • RobyRRobyR Member Posts: 39
    I had the same problem with NAV 17, the solution is to upgrade the application to the last CU (only the application, not the objects).
    There is an interesting powershell tool to split the NAV DVD into client, service,.. folders to simplify in case
  • Peter_KuiperPeter_Kuiper Member Posts: 19
    Thank you for your reply.
    I just installed CU19, and now it works fine.
  • RobyRRobyR Member Posts: 39
    > @Peter_Kuiper said:
    > Thank you for your reply.
    > I just installed CU19, and now it works fine.

    Perfect, I'm happy it helped you 👍
Sign In or Register to comment.