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 🙂

Advertisements
Advertisements

7 responses to “How to Debug Plug-Ins in CRM”

  1. suhad Avatar
    suhad

    nice one

  2. Debug Plug-ins using “Plug-in Profiler” – CRM 2011 | Rajeev Pentyala - Dynamics CRM Blog Avatar

    […] can debug the plug-ins deployed in “on premise” by following the steps in this article. But it’s always difficult to debug Plug-ins deployed in CRM […]

  3. João Leme Avatar

    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.

  4. punditor Avatar

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

    Thanks

  5. Bhupendra Singh Avatar
    Bhupendra Singh

    Thanks a lot Rajeev.
    This article was really helpful.

  6. Iklan gambar

    How to Debug Plug-Ins in CRM | Rajeev Pentyala – Dynamics CRM Blog

Leave a reply to Iklan gambar Cancel reply