The other day a partner asked me about how to start the Microsoft Dynamics NAV 2013 C/AL Debugger for another NAV Server instance than the one used by C/SIDE.
The explanation is below, but first, let’s see how C/SIDE finds the NAV Server instance used for running and debugging.
The Microsoft Dynamics NAV Server Instance used by C/SIDE for Run and Debug
When you Run an application object from the C/SIDE Object designer, C/SIDE is starting a Dynamics NAV Windows client with the application url constructed from:
- NAV Server as defined in File/Database/Information Server Instance field (see Database Information)
- Current selected Company in C/SIDE
- Type and id of the application object you run
Read more here: Starting the Windows Client at the Command Prompt, the URL parameter.
This could be an example:
Microsoft.Dynamics.Nav.Client.exe "DynamicsNAV://localhost:7046/dynamicsnav70/CRONUS International Ltd./RunPage?Page=42"
The rest of the client configurations are taken from the default ClientUserSettings.config, which is typically found at %APPDATA%\Microsoft\Microsoft Dynamics NAV\70.
The same principle is used when you start the debugger from within C/SIDE Tools/Debugger/Debug Session.
All this works quite well in more confined setups where you can address different databases and NAV Servers if you are using the same authentication type for them all, but if you want to address different NAV Servers having for example different authentication types, you have to find other solutions – feel free to be inspired by how to.
Define Alternative Ways of Starting the Microsoft Dynamics NAV 2013 C/AL Debugger
Now let’s say you have made a dedicated NAV Test environment with:
- a separate database
- dedicated NAV Server(s)
- another client authentication type than you are using in your Development environment
- no development environment installed
… and you want to debug some issue that appears in the Test environment from your development environment machine.
The trick is to create a Dynamics NAV Windows client shortcuts on your development machine that specifies:
- a client settings config file that describes the NAV Server that should be targeted
- Read more here: Starting the Windows Client at the Command Prompt, the settings:file parameter.
- Read more about how you edit a Client user settings config file here: Configuring the Windows Client.
- an application url specifying the debugger
- Read more here: How to: Activate the Debugger at the Command Prompt
Ending up in a combined command line description:
Microsoft.Dynamics.Nav.Client.exe -settings:file "DynamicsNAV://< Server>[:<port]>/<ServerInstance>/<Company>/debug"
Or the short-form (all defaults to the .config settings):
Microsoft.Dynamics.Nav.Client.exe -settings:file "DynamicsNAV://///debug"
Adding up to shortcut examples like this:
Microsoft.Dynamics.Nav.Client.exe -settings:"%USERPROFILE%\Desktop\TestEnv.config" "DynamicsNAV://///debug"
Microsoft.Dynamics.Nav.Client.exe -settings:"%USERPROFILE%\Desktop\ProdEnv.config" "DynamicsNAV://///debug"
Or with full paths like this:
"%ProgramFiles(x86)%\Microsoft Dynamics NAV\70\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe" -settings:"%USERPROFILE%\Desktop\TestEnv.config" "DynamicsNAV://///debug"
The Windows client specifically understands the “special” /debug url, which is currently a “shorthand” for starting the client with:
- -debug (that sets the CURRENTEXECUTIONMODE to Debug and groups the debugger clients separately in the taskbar under the debugger icon)
- -shownavigationpage:0 (i.e. not showing a role center)
- And do what’s defined in ApplicationManagement (Codeunit 1). LaunchDebugger (Trigger 60)
- Typically, running the “Session List” (Page 9506)
The debugger can be started this way because it is working similar to any Microsoft Dynamics NAV solution.