Today I would like to share my practical experience which I came across while working with Plug-In in our environment.
I what to explain about two things here
- Debug a Plug-In online using Remote Debug method
- Debug a Plug-In using Profile and Debug Options in Registration Tool
Debug a Plug-In online using Remote Debug method:
1) Make sure you have Remote Debugger tool installed on your CRM 2011 Server. If you do not find the remote debugger tool then please down load and install the “rtools_setup_x64.exe”
2) Once the Installation is done then you can see the Remote Debugger Service Installed on the server with disabled Mode.
3) Enable and Start the Service with Manual Start Up Type (this is optional. You can use Auto Start Up Option even for service Start Up).
4) Register the Latest Plug-In DLL By using Registration Tool or By Using CRM 2013 SDK Developer Tools (Dynamics CRM 2013 Package Solution Deploy method).
5) Browse the CRM Organization from your browser so that the W3WP.exe Process will be up and running on the CRM server.
6) Open the Plug-In Development environment (IDE) and Keep the Break Point in Plug-in Execution Method.
7) Once After this, Invoke the “Attach to Process” method which you can Navigate through Debug Menu in the Development IDE.
8) Attach the W3WP.exe from the CRM server Processes.
9) Perform the required operation in CRM organization so that the Plug-In code will get executed.
10) Now you can see the stopping of the code execution at your breakpoint.
Debug a Plug-In using Profile and Debug Options in Registration Tool:
1) Open the Plug-In Development environment (IDE) and Keep the Break Point in Plug-in Execution Method. Build the Plug-In DLL.
2) Open the Plug-In Registration Tool
3) Register the Latest Plug-In DLL By using Registration Tool or By Using CRM 2013 SDK Developer Tools (Dynamics CRM 2013 Package Solution Deploy method).
4) Check whether the Profiler got installed or not by using the Plug-In registration tool?
5) If the Profiler was not installed then install the Profiled by using the Install Option in Plug-In registration tool.
6) Select the Specified Step in your Plugin Assembly and click on “Profile” button in Registration tool.
7) Browser the CRM Organization and perform required operation so that your Plug-in code will get executed.
8) You will get populated with an Error Message. Download the Error message and save that into a file.
9) Now come to the Plugin Registration tool back and Click on “Debug” button which you can see just beside the “Profiling” Button.
10) This will open a window (Debug Existing Plug-In) and asks for Profile path and Assembly path. Please provide the Downloaded error file path in the profile path and Plugin Assembly path in Assembly path.
11) Once after that Navigate to Plug-In Development environment (IDE) and Attach the “Plug-In Registration exe process” by using Debug–> Attach to Processes.
12) Now Open the Debug Existing Plug-In window and click on “Start Plug-In Execution” button
13 ) Now you can see the stopping of the code execution at your breakpoint.
Hope this Helps!:)