16 Jan 2008

Remote debugging sounds like the title to a book but it isn't - in truth, I have never used remote debugging because haven't needed to. In MSCRM 3.0 the exceptions bubbled up nicely in workflow and I could do a lot on my own machine. However in MSCRM 4.0, those exceptions don't bubble up nicely :( All you get is something like this:

Beside's adding logging to your assembly (which you should do anyway), what's a dev to do now? You can now debug your plug-in's and custom workflow activities using the remote debugging facility in Visual Studio and that's what I hope to show in the next 9 easy steps!

  1. On your machine you'll find a folder <system drive>\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger (assuming you installed Visual Studio 2008 to the default location) which contains an x86 folder. Copy that to the MSCRM server and run the msvsmon.exe file.
  2. Now click Tools -> Permissions and give yourself access to it.
  3. Now load you plug-in or custom workflow activity (when I refer to plug-in for the rest of the document it means both, unless otherwise stated) using the *cough*annoying*cough* plug-in registration/developer tool.
  4. Next copy the PDB file for your assembly to the <system drive>\Program Files\Microsoft Dynamics CRM\Server\bin\assembly (assuming you installed MSCRM 4.0 to the default location).
  5. Now to finish up the MSCRM server side do an IISReset and restart the Async Windows Service.
  6. Back on your machine now in Visual Studio, set a break point in your code.
  7. Next click Debug -> Attach to Process. The transport should be Default and the Qualifier should be <domain>\<username running msvsmon.exe on the server>@<Server name>. Note: You can get this from the Tools -> Options in msvsmon.exe. You may need to do some firewall configuration but it should be automated.
  8. Next select the process to attach to, for an online plug-in, attach the debugger to the w3wp.exe process on the Microsoft Dynamics CRM server. For an offline plug-in, attach the debugger to the Microsoft.Crm.Application.Hoster.exe process. For asynchronous registered plug-ins or custom workflow activity attach to the CrmAsyncService.exe process.
  9. Now do whatever is needed to trigger your event and watch Visual Studio on your machine do it's magic!



Victor's picture


I already have CRM 3.0 on my computer and would like to upgrade to CRM 4.0.

Shall I have to run CRM 4.0 setup and then uninstall CRM 3.0? or is there a better way?

Thank you.

Tiaan van Niekerk's picture

HI Trevor Backup all your data first. What is your infrastructure for the upgrade SQL ver? OS ver?
Attaching Custom workflow activity to a process (Debugging)'s picture

[...] etc.... I'm trying to attach my workflow to a process. I followed the steps in the below article http://www.sadev.co.za/node/153 I tried both w3pw.exe and Asuncronouscrm.exe. Below is my code. (I created a workflow activity [...]

Brutus Online » CRM 4.0 plugin voor dummies's picture

[...] Is debuggen mogelijk en zo ja : hoe? Daar kan ik een heel mooi epistel over schrijven maar dat kunnen anderen [...]

Szczepan Bury's picture

I followed the instructions but the breakoint shows me the message that it will not be hit because no symbols have been loaded for the document, how can i fix this? Thanks
Robert MacLean's picture

Make sure you build in debug mode and take the PDB file across with the assembly when you install it. That should solve it.
Visitor's picture

still doesnt work

Debugging plug-ins in v4.0 (Updated) &amp;amp;laquo; The CRM Gri's picture

[...] just found this article at sadev.co.za on how to debug CRM plug-ins remotely. Possibly related posts: (automatically generated)Prevent [...]

CRM User's picture

Thanks a lot for the post. Can some please tell me how do i debug the custom workflow assemblies in CRM 3.0 ?
Anonymous's picture

Make sure you sign your assembly. If it's not signed, this will not work.

Weasy - Dynamics CRM's picture

Great solution to the debugging hassles for on premise solutions. However when using CRM Online variants, this will not work. Only option is to use extensive tracing there.

jim denney's picture

How do I turn off remote debugging. We are hitting a 3rd party vendor who is not going to let us do this. But My app tries to do this, throws an error and won't connect. So I essentially have no debugging because this ^%&^#$ feature won't let me connect to see what the real problem is.

Add new comment