Options

How to debug NAS

jony_kwa888jony_kwa888 Member Posts: 9
HI All,

I have been trying to debug code in NAS.
I follow the instrusction in the disc documentation which basically said that you need to have DEBUG keywords on installing the NAS.

I did and put the break point in the report/codeunit that NAS suppose to call but it never breaks. Do i need to include the breakpoint file or something?

btw, I'm using job-queue instead of straight NAS, will that make an impact?

Comments

  • Options
    ara3nara3n Member Posts: 9,255
    you need to start NAS from cmd prompt with Debug parameter and all the other paramater like db, server, company, etc.


    I can't remembe 100 percent but you can put the file or it will error when job queue runs and runs your codeunit. then you can put breakpoint in debugger.

    There is no difference between Nav client and NAS except no Dialog can be opened or confirm question asked.

    I wish NAS ignored them.

    Job queue writes down the error. what error do you get in job queue?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    ara3nara3n Member Posts: 9,255
    I just read your other post on printing issue.

    Just start it from cmd prompt with debug parameter and the dugger will start at first error.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    jony_kwa888jony_kwa888 Member Posts: 9
    Thank you for your responses.

    You guys mentioned about error. Is that mean that it needs to hit error before it can be traced?

    can I just put a break-point in the code and expect the debugger to hit the break-point even there is no error?

    Thank you.
  • Options
    kinekine Member Posts: 12,562
    1) Sometime you need to place developer license into NAS folder if you want to run debugger in NAS
    2) You can use breakpoints, but you do not have IDE to set them. It means you need to set them in Client, find the breakpoint.xml where the breakpoints are saved and use this file as parameter when running NAS from CMD (pameter "breakpoints").
    3) If you enable debugger, NAS will start with debugger in "Stop on triggers" mode. Than you can go through code and set breakpoints in the actual object. It mean, if you need to set breakpoint in codeunit called from NAS handler in CU1, you need just to hit F5 once, and than find the code in the codeunit and set breakpoint...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    ta5ta5 Member Posts: 1,164
    Although it's not 100% the same, quite a handy possibility is to start the nas codeunits from a normal client and debug it from there. Keep in mind that the user credentials may differ, because nas always uses a window login.
    Thomas
  • Options
    garakgarak Member Posts: 3,263
    For starting the NAS in debugmode, do following.

    Stop the Service, be sure, your windows login is authorize to login on the database.

    Open CMD. Go to the folder where your nas.exe or nassql.exe is stored.
    Type following (example for NASSQL).
    nassql debug,appservername="YourNASName",servername="DatabaseServer\NamedInstance",database="YourDatabase",
    company="YourCompany",startupparameter="YourStarUpParameter",
    objectcache=32000,nettype=tcp
    

    Regards
    Do you make it right, it works too!
  • Options
    primeapprimeap Member Posts: 37
    2) You can use breakpoints, but you do not have IDE to set them. It means you need to set them in Client, find the breakpoint.xml where the breakpoints are saved and use this file as parameter when running NAS from CMD (pameter "breakpoints").

    Hi is this true, can someone tell us where to find this xml-file?
  • Options
    jerrykimjerrykim Member Posts: 1
    To debug in NAS in NEP I

    1. Used a .BAT file with the following info:

    "D:\Program Files\Microsoft Dynamics NAV\Application Server\nassql.exe" Debug,Breakpoints=D:\Breakpoints.xml,appservername=<servername>-SQL,servername=servername,DATABASE=<databasename>,company=<companyname>,startupparameter=NEP-1

    2. In the debug window that appeared I unchecked the "Break on triggers" and pressed F5

    4. Ran the application

    3. Set a breakpoint where it encounters an error and breaks or created an error (e.g. ERROR('test') )then set breakpoints. The breakpoints will be saved in the .XML which I created. :D
  • Options
    absolutelyfreewebabsolutelyfreeweb Member Posts: 104
    Breakpoints that are stored in the Breakpoints virtual table are automatically stored
    in a NaviBP.xml file. The file is located by default in the same folder as the fin.zup
    file. On a Windows 2000 or Windows XP computer, the path is: C:\Documents and
    Settings\user\Application Data.
Sign In or Register to comment.