How to debug a plugin in Dynamics 365 online using plugin profiler

How to debug a plugin in Dynamics 365 online using plugin profiler

In this post we’ll learn how one can debug a plugin code in Dynamics 365 online or Dynamics CRM online environment.

What you need is dynamics 365 SDK which ou can download from here.

Below is the Step by Step procedure to debug a plugin in Dynaamics 365/Dynamics CRM online:

Step 1: Download and extract Dynamics 365 SDK  in any folder.

Step 2: Now navigate to SDK\Tools\PluginRegistration

Here you’ll see pluginRegistration.exe file.

 

Double click on it and create a new connection.by clicking “Create New Connection”

1

Step 3: Click on login. It’ll ask for credentials.

Provide your dynamics 365 username and password and click sign in.2.PNG

Step 4: Now it’ll display the available instances of your organization.

Select the one in which your plugin exist you want to debug.

It’ll display the list of existing assembly deployed in that  instance.

 

Step 5: Click on install profiler button on top ribbon of Plugin Registration tool.

3.PNG

Once it’s done, it’ll look like this:

4.PNG

Also a solution is created in Dynamics CRM instance as shown below:

5.PNG

 

Step 6: Now select the step you want to debug in plugin registration tool and click Start Profiling.6

Click ok in next window:

7.PNG

As you click OK,the plugin step is updated as below:

8.PNG

Step 7: Now perform the operation on which the above step has been registered.

It’ll generate an exception and a log file which you need to download and save.

It’ll be used in step 9.

Step 8:  Now open the plugin solution in Visual studio and Add the breakpoint  in plugin code from where you would like to debug.

Now click on debug and then click attach to process.

Below window will pop up where you need to select PluginRegistration.exe adn click on attach:

9.PNG

Step 9: Now click on debug in plugin registration tool as shown below:

10.PNG

Now below window will open where you need to select the log file downloaded in step 7 in Profile, specify plugin dll assembly location in Assembly location and select the step in Plugin as shown in below image and click “Start Execution“:

11.PNG

Step 10: As soon as you click on Start Execution, the debugger stops at the breakpoint inserted in code in step 8 as shown in below screenshot:

12.PNG

 

Now you can debug the code line by line further by pressing F10.

Hope this post was helpful.

In case you face difficulty in any step, please comment.

 

 

7 thoughts on “How to debug a plugin in Dynamics 365 online using plugin profiler

Add yours

  1. Hi

    I’ve done exactly what you’ve written in the article, everything is fine until the step 9. At this step when I click “Debug” button nothing happens (Replay Plug-in Execution window just doesn’t open).
    I’m trying to debug a plugin step that is registered in D365 v9.

    Thanks in avance,
    Alex

    Like

    1. Sorry for late reply. I need to see if there is some issue you’r facing. I would recommend to test your plugin code in a console application if possible. It’s easy and convenient.

      Like

  2. For those experiencing problems:

    To download the log file, you need to put your plugin in Synchronous mode. Asynchronous plugins don’t give you the option to download the log file, as these end up in the System Jobs.

    I hope this helps you out!

    Kind regards

    Sven V.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: