Home > CRM 2011, Plug-Ins > How to Debug Plug-Ins in CRM

How to Debug Plug-Ins in CRM

Hi,

Sometimes you might get wonder (even frustrated) why the debugger is not hitting the break point in your Plug-In code file.

Below are the Checklist to perform prior to start the debugging of your Plug-in assembly.

  • Ensure that your plug-in assembly is signed (See)
  • Rebuild the plug-in assembly
  • Reset the IIS (i.e. Open command prompt and run ‘iisreset’ command)
  • Restart CRM Asynchronous Service on CRM server (Only in case of asynchronous plug-in or Custom workflow )
  • Copy the .pdb file and your .dll file to server’s assembly (i.e., ..\Program Files\Microsoft Dynamics CRM\Server\bin\assembly)
  • Open the Plug-in Registration Tool (Download)
  • Browse the dll from your Plug-Ins projects “bin\debug” folder
  • In Plug-in Registration Tool , Choose “Specify the location where assembly should be stored” option as “Disk”
  • Register the step
  • Register the image(s) if any
  • Attach the process by opening the Plug-in project in the Visual Studio and then
    • From menu choose “Debug -> Attach to Process…” ( or Click ‘Alt + Ctrl + P’)
    • Select  w3wp.exe (i.e.,Worker Process), if plug-in is Synchronous
    • Select CRMAsyncService.exe, if Plug-in is asynchronous or Custom workflow.
Attaching Worker Process (w3wp.exe)

Attaching Worker Process (w3wp.exe)

  • You are all set by now and put a break point (Click F9) on relevant code line.

In case of Remote Debugger :-

  • If your CRM server machine is different from your development machine
  • Install “Visual Studio Remote Debugger” (Download) on CRM server machine
  • Run it as “Administrator”
  • Follow the same steps above except while attaching Process, in the “Attach to Process” window, set “Qualifier” as “CRM server machine”

Debug plug-in in outlook offline mode

  • Clean and rebuild the plug-in solution on your machine using visual studio
  • Register the plugin on the server
  • Synchronize the organization with the outlook
  • Go Offline
  • Attach the debugger to the process “Microsoft.Crm.Application.Hoster.exe
  • Place a breakpoint in the code.
  • Run the scenario

Hope it helps 🙂

  1. suhad
    January 18, 2012 at 7:23 PM

    nice one

  2. July 22, 2013 at 7:41 AM

    Having trouble debugging an async plugin on CRM ONLINE. No exception log thrown. Any recommendations? I guess I will have to register for sync in order to testit.

  3. November 2, 2013 at 3:14 AM

    hi, nice post on CRM Plugins debugging. very straight forward and easy to follow.

    Thanks

  4. Bhupendra Singh
    September 26, 2014 at 3:37 PM

    Thanks a lot Rajeev.
    This article was really helpful.

  5. April 24, 2018 at 12:20 PM

    Reblogged this on Arun Potti's MS CRM blog.

  1. March 22, 2013 at 7:56 PM
  2. September 25, 2015 at 11:01 AM

Leave a comment