Debugging Dynamic Entities in CRM 4.0


Recently, I've been spending quite a bit of time with the Microsoft Dynamics CRM SDK, building custom plug-ins for CRM 4.0. One of the tricky aspects of working with the IPlugin interface is that you have to use the DynamicEntity class when accessing the InputParameters and OutputParameters properties of the IPluginExecutionContext interface.

This wouldn't be so bad, except that it is a real pain trying to find out what properties and values are actually contained within a Dynamic Entity whilst debugging and so I kept having to write the same "test" code over and over again just to examine their contents. However, a couple of months ago I found out you can extend Visual Studio to provide this support by implementing a custom “debugger visualizer”. Visualizers are represented in the Visual Studio debugger by the magnifying glass icon. When you see the magnifying glass in a DataTip, in a debugger variables window or in the QuickWatch dialog box, you can click on the magnifying glass to select a visualizer appropriate to the data type of the corresponding object.

clip_image002

After playing around with Microsoft Visual Studio for a few hours I came up with a really cool visualizer that provides detailed info about any dynamics entity when debugging a plug-in. I posted a detailed article on my blog, including all the source code for you to use in your own development project, which you can find here - http://blogs.msdn.com/ukcrm/archive/2008/07/08/creating-a-debugger-visualizer-for-dynamic-entities.aspx

Happy debugging,

Simon Hutson

Skip to main content