Recently came across an awesome Tool to Debug a Plugin without Installing the Profiler or adding the Traces in the Plugin Registration Tool which was done by Nicolas Prats and this will really save our development efforts.
In this article, will explain his Tool in step-by-step process of plugin debugging.
Plugin Scenario: Get the Contact’s First name and Last name and convert the columns data to Upper case on Contact create.
Plugin Code screenshot is given below.
Registered the plugin in the Plugin Registration Tool.
Follow the below steps to start the Plugin Debugging process.
Step 1: Click on the link to navigate to Nicolas Prats GitHub.
Step 2: Scroll Down and Click on the latest release.
Step 3: Click on the latest release.
Step 4: Click on Dataverse.Browser.V0.0.0.2.zip.
File will be downloaded.
Step 5: Once the file is downloaded, go to the Downloads folder and locate the folder.
Step 6: Right click on the folder and Click on Extract All…
Step 7: Click on Extract.
File extraction is in progress and after the extraction, unzipped folder will be opened.
Step 8: Click on start.
Step 9: Click on More info.
Step 10: Click on Run anyway.
Step 11: Click on New …
Step 12: Provide the details as shown in the Environment Settings and Click on Go.
|Choose a name for this environment
|Provide a name for the environment
|Provide the instance url without https
|Plugin’s Dll path in the Debug folder
Step 13: Dynamics 365 CE Authentication pop up will be opened.
Pick an account or Click on Use another account.
Step 14: Give your Email and Click on Next.
Step 15: Enter password and Click on Sign in.
Separate Browser window will be opened.
Note: Below browser window might take few Seconds to Minutes to Open.
Step 16: Provide the Email and Click on Next.
Step 17: Enter Password and click on Sign in.
Step 18: Click on Yes.
Step 19: Click on the required Model Driven App.
Step 20: Click on New to open a new contact to repro the plugin scenario.
Step 21: Click on Erase button to Clear the history of requests.
All Web API requests history is deleted.
Step 22: Enter the Mandatory fields in the Contact record and Click on Save.
Step 23: Got the Object reference error and Click on OK.
Step 24: On the Right-Hand side, you can see the Web API requests in Red color Icon. Expand it to see the Failed Plugin details.
Step 25: Click on the Web API request and Click on Debug button to Attach a debugger.
Step 26: You can see the list of all Available Debuggers. Select the Plugin Solution and Click on OK.
Step 27: Click on Continue.
Step 28: You can see the below message that the Debugger is attached. Click on OK.
Step 29: Put a Breakpoint in the Plugin Code.
Step 30: Try to Save the Contact record now to hit the breakpoint in the Visual Studio.
Debugger point will come to Visual Studio automatically.
Start Debugging and fix the code.
I got the error at line 44.
You can update the code, even the debugger is running and test it again without redeploying the Dll in the Plugin Registration Tool.
Test it thoroughly and update the Dll in the Plugin Registration Tool, once everything is working as expected.
Hope you have followed all the steps and tested the plugin code successfully.
Please like and share your valuable feedback on this article.
My earlier articles related to Dynamics 365 CE that you can have a look.