Debugging

The process of finding and correcting errors is called debugging. Microsoft Dynamics NAV 2013 R2 provides an integrated debugger to help you inspect your code to verify that your application can run as expected. The debugger UI runs in the Microsoft Dynamics NAV Windows client or the Microsoft Dynamics NAV Web client. The debugger services run on the computer that is running Microsoft Dynamics NAV Server.

For a tour of the new Microsoft Dynamics NAV Debugger, see Walkthrough: Debugging the Microsoft Dynamics NAV Windows Client.

Note

In Microsoft Dynamics NAV 2009, you used Visual Studio to debug objects on the computer that is running Microsoft Dynamics NAV Server, and you used the Microsoft Dynamics NAV Debugger to debug objects running on the Classic client. You cannot use Visual Studio to debug objects on the computer that is running Microsoft Dynamics NAV Server in Microsoft Dynamics NAV 2013 R2. Instead, you use the Microsoft Dynamics NAV Debugger.

Business Sessions

To start debugging, you attach the debugger to a business session. The business session that you select can be any of the following:

  • Microsoft Dynamics NAV Windows client session.

  • Microsoft Dynamics NAV Web client session.

  • OData web services session.

  • SOAP web services session.

  • NAS services session.

  • Background session that you start by using the STARTSESSION Function (Sessions).

After you attach the debugger, program flow runs until it reaches a breakpoint.

The remaining unattached business sessions continue to run without interruption.

For more information, see Activating the Debugger.

Breakpoints

The basic concept in debugging is the breakpoint, which is a mark that you set on a statement. When the program flow reaches the breakpoint, the debugger stops execution until you instruct it to continue. Without any breakpoints, the code runs without interruption when the debugger is active. For more information, see Breakpoints.

Debugging Requirements

To use the Microsoft Dynamics NAV debugger, the user who is logged in must be assigned the SUPER permission set for all companies. To assign the permission set for all companies, on the User Card page, under User Permission Sets, leave the Company column blank. If you assign the SUPER permission set for a specific company, then you get an error that you must be a member of the SUPER user role. For more information, see How to: Define Permissions for Users.

Assigning the SUPER permission set for all companies is required because a user who is debugging has access to business data in the debugged session.

Important

If you want to debug code that contains multiple INSERT statements, we recommend that you disable bulk inserts. If a loop with multiple INSERT statements is being buffered for a bulk insert, the Microsoft Dynamics NAV debugger cannot step through that code. If you disable bulk inserts, the debugger will step through the code as expected. For more information, see Bulk Inserts and Configuring Microsoft Dynamics NAV Server.

Disabling Debugging

If you do not want any user to be able to debug sessions on Microsoft Dynamics NAV Server, then you must disable debugging. This is useful if you have concerns about how to allow your data to be seen through the debugger. For more information, see How to: Disable Debugging.

Troubleshooting Protocol Mismatch Errors

We recommend that you do not use the settings parameter when you start a Microsoft Dynamics NAV Windows client if you later want to use that Microsoft Dynamics NAV Windows client to start the debugger. When you start the debugger from Sessions page, it uses some information from the default ClientUserSettings.config file, not the config file that you specified with the settings parameter when you started the Microsoft Dynamics NAV Windows client. There can be differences in the connection properties, which causes a protocol mismatch error.

For more information about the settings parameter, see Starting the Windows Client at the Command Prompt.

See Also

Tasks

Walkthrough: Debugging the Microsoft Dynamics NAV Windows Client

Concepts

Avoiding Run-Time Errors
Using About This Page and About This Report