Twitter Image

Debugging CRM Online

Written by Stéphane Dorrekens
Thursday, 05 April 2012 07:46

I followed a presentation the other day where the Plug-In profiler was mentionned; I remembered having heard briefly about it but never grasped the full significance and usefullness of it.
What this profiler allows you to do is to debug a plug-in in an after the fact fashion, which means Plug-Ins deployed in a online environment can be debugged as well; and this is a lot better than trying to emulate what is happening in a test sandboxed environment on premise.
There's also a limitation in that you need to trigger an exception to catch the log and replay it afterwards, but you could always end normal execution with a throw if you need to.

Basically, what the profiler allows is to simulate a context and run a specic plugin code onto it; this leads to a bunch of other benefits:
- You can iterate very fast codes changes and tests as you don't need to re-deploy,resimulate interaction in Mscrm; you can just replay the saved context on the new code.
- In support, you can capture the context at a customer site (on premise or online) and replay it at will without impact on the customer data (it's the major difference between debugging and replaying)
- You could design unit test validating against a given context.

The MSDN article about the profiler can be found here and a nice step by step blog post by Guru Prasad can be found here.