Skip to main content

Debugging in NAV 2009,2009SP1 & NAV2009R2 RTC Client

Hi all,

With the new client version of Navision the debugging process have also been changed.

This post contain details of NAV 2009, NAV 2009 SP1 and NAV 2009 R2 RTC Client.

First step is to Stop the Microsoft Dynamics NAV Server Service.

Then we  need to don EnableDebugging in CustomSettings.config found here: C:\Program Files\Microsoft Dynamics NAV\60\Service.

Now start the Microsoft Dynamics NAV Server Service.
Now we have debugging enabled. Now start the RoleTailored client. This will take a bit longer to start up, because C# files are generated for each of the objects. (Pages, Codeunits, Reports etc.) - .cs files will be created.
In this example I will make a codeunit with a simple message and add this to an action on the Customer list.
Create a Codeunit. Ex. 50000
OnRun trigger place the following code: MESSAGE ('Debug test')

Save and compile Codeunit 50000.
Now let us add this codeunit to a action. Design page 22 and navigate to the Actions on page 22.


Insert a new action below the the Customer Action group


Hit F9 and enter this code on the Debug test -  OnAction trigger: CODEUNIT.RUN(50000);
Save and compile page 22


we now have all code completed so now let us set a breakpoint in Visual Studio.
Navigate to “C:\ProgramData\Microsoft\Microsoft Dynamics NAV\60\Server\MicrosoftDynamicsNavServer\source\Codeunit” IN WINDOWS 7
Assuming that you have Visual Studio installed, (In my case I’m using Visual Studio 2008 with SP1) open Codeunit50000.cs
If you have UAC turned you will need to open Visual Studio with “Run as administrator”.
Now we need to attach the NAV service. Select “Debug / Attach to process…”
Attach Microsoft.Dynamics.Nav.Server.exe
Your screen should now look like this:
Now add a break point on the message “Debug test”
With this done now let us go to RoleTailored client.
Navigate to Customer List and see that you have a new action called “Debug test” under “Related Information”
Now select “Debug test”
Visual Studio will come back in focus with the breakpoint selected.


Now try to hit F5 and debugging will continue and RoleTailored client will come back in focus and show the message “Debug test”:
"In Next post i will discuss the Debugging Process in NAV 2013 which is an enhanced version of Debugging. i Personally feel that its a better version than debugger in classic client and RTC Client till NAV 2009 R2."
Regards,
Saurav  Dhyani



Comments

Popular posts from this blog

BC 21 and Higher - PowerShell Cmdlet (Replacement of Business Central Administration).

Hi Readers, As discussed in last article about deprecating of Business Central Administration, there are few common actions that we use in administration till Business Central 20. For our on-prem customers, we will still require doing activities. As Microsoft suggest we need to start using PowerShell cmdlet.    Let's see how to do those via PowerShell, or Administration Shell. I will be keep adding commands as you comment to this article.

Send Mail with Attachment From Navision.

Hi all, We have seen how to save a report into PDF and how to send mail to a customer. Let's link these two post in one i.e. Mailing statement to a customer into PDF Format. This article is part of the Series. Please Refer  Table of Content here . If you have the old objects set let me brief you what I will be changing - 

MSDYN365BC - Data Upgrade To Microsoft Dynamics 365 Business Central on premises.

Hi Readers, We have already talked about the number of steps for upgrading to Business Central on Premises from different NAV versions. After that article, I received multiple requests for an article which list down steps for Data Migration. In this article, we will discuss steps of data migration to MSDYN365BC (on-Prem) from NAV 2017. For this article, I am considering a Cronus Demo Database without any customization. For an actual upgrade project, we will have to complete object merge using compare and Merge process. After the Merge Process, the next step is data migration. Let's discuss those steps. Direct Upgrade to Microsoft Dynamics 365 Business Central (on-Prem) is from following versions - 1. NAV 2015. 2. NAV 2016. 3. NAV 2017. 4. NAV 2018.