Problem C/AL not updated

NavDaveNavDave Member Posts: 13
Hi everyone,

I don't know if this is a common Nav Bug but sometimes when I modifiy a C/AL CodeUnit, Save+Compile and then run,
the CodeUnit doesn't launch with the NEW modified code. Instead, it run the previous CU before the changes.
I have to restart NAV in order to have NAV run the changed CU. ](*,)
Is there a fix for this ?

I'm using NAV 21009 r2

Thank you for the help!

David

Comments

  • SavatageSavatage Member Posts: 7,142
    when you save save-compile-run are you running it from the designer?
  • himanshihimanshi Member Posts: 15
    Hey! Your Question is not clear. Whether u r changing the code on OnRun trigger of codeunit or in function in a codeunit?
    first specify where u r changing the code?
  • amr_wafaamr_wafa Member Posts: 23
    Hi,

    I think the "SingleInstance" property is set to Yes.

    rt?
  • NavDaveNavDave Member Posts: 13
    himanshi wrote:
    Hey! Your Question is not clear. Whether u r changing the code on OnRun trigger of codeunit or in function in a codeunit?
    first specify where u r changing the code?

    I modify the codes in any methods of my own CodeUnit that I've created.
    For example, I add a line like:
    MESSAGE('Hello World');
    
    Then I save and compile and Run the CodeUnit.
    The message box shows up correctly.
    After that I go back to the CodeUnit and put that same line in comment and compile it:
    //MESSAGE('Hello World');
    
    But when I run it, the message box still shows up. Moreover, I can see that the line is not commented inside the debugger.
    To work around this, I have to completely close and restart NAV...

    I work in a virtual machine which shares the nav application with other coworkers but each one of us logs in their own Windows account.

    Also, the SingleInstance property is set to "NO" but that's not the problem.

    Any idea what could it be ? :-k

    Thanks,

    Dave
  • himanshihimanshi Member Posts: 15
    Try this
    For example, add a line like:
    Write this code either in a function or On the OnRun trigger of the codeunit.
    MESSAGE('Hello World');
    
    Then save and compile and Run the CodeUnit. And also check the Single instance property is set to No.
    The message box shows up the message.
    after that go back to the CodeUnit and put that same line in comment and compile it:
    //MESSAGE('Hello World');
    
    , the code will not be run.
    If you set the single Instance Property to yes then only this problem occurs. that you have to start Navision again...
  • MBergerMBerger Member Posts: 413
    I think the "problem" here is the object cache. Am i correct in assuming you are checking the new code on a DIFFERENT machine than the one you are coding on ? if so, you need to restart NAV, because if it has been used recently, the old version of the codeunit will still be in the cache.
  • NavDaveNavDave Member Posts: 13
    Hi everyone,

    Thank you for the help.
    I think I found the solution which is as silly as leaving only one Codeunit open.
    I actually had two or more same CU Windows opened in the background. #-o
Sign In or Register to comment.