Application Server Debugging

Greetings - I’ll try to explain this clearly…hopefully it makes sense! For a client, we are using the Application Server to trigger a codeunit on startup. The codeunit has a Timer event, which polls a “Scheduled Event” table for any activities that are due to run (i.e. Next Run Date/Time < current date/time). For those activities, it triggers a specified codeunit. For example, we have a codeunit that runs an export of data to another system, so that is set up as a scheduled event. For a few such scheduled codeunits, the result returns “SUCCEEDED” (we fill that result in on the Scheduled Event record using the result from “IF CODEUNIT.RUN(#) THEN…”). For one codeunit, however, the result always fails when the application server triggers it. This only happens when the application server triggers the codeunit - when an actual navision client is opened up (and logged in under the same windows login used for the application server) and the codeunit is run manually, it works fine. My challenge is how to determine the cause of the failure. Using “IF CODEUNIT.RUN THEN…” traps for any error, so I don’t have a way to see what it was. If I change this to just RUN the codeunit with no IF trapping, how can I see what the error is when the application server has no user interface? If I take that approach, would the actual error get logged in the Event Viewer or someplace??

Hi, Errors in your code are ending up in the event log of the machine that runs the application server, and if I remember correctly with the same event description that a normal client would have received as an message in the client. It can be very hard to debug though, since you don’t have any debugger for the application server. On my former employer were we used the application server a lot, we always had a tough time to debug. We had a codeunit from where we could execute the same code as the application server do, so that we could see the error message. However, some errors (like if a form is used, which is allowed in the client but not in nas) were impossible to reproduce under a normal client. So in order to handle these, we built a table were we created a record for each step in the code (dont forget commit, otherwise the error will create a rollback). This way we at least could see how far the code went and take it from there. I would like to have the client monitor and code coverage functionality in nas as well, then it would be much easier to debug errors. Maybe in the next version… :wink: Regards Daniel

There’s a new dll called Navision Timer 1.0. It calls a trigger when an error occurs. This allows you to log the actual error message as it occurs. Use this timer instead of cp timer.