How to debug a plugin in Dynamics 365 online using plugin profiler
Download Dynamics 365 SDK.
Below is the Step by Step procedure to debug a plugin in Dynaamics 365/Dynamics CRM online:
- Download and extract Dynamics 365 SDK in any folder
- 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”.
- Click on login. It’ll ask for credentials. Provide your dynamics 365 username and password and click sign in.
- 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.
- Click on install profiler button on top ribbon of Plugin Registration tool.
- After installation of Profiles it will show the following screen
- It will creqate a solution in Dynamics CRM instance as shown in below screen
- Now select the step you want to debug in plugin registration tool and click Start Profiling and then click on Next button.
- As you click OK,the plugin step is updated as below
- 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.
- 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 and click on attach button as shown in beloww screen
- Now click on debug in plugin registration tool as shown below
- 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“:
- 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