Trace and Debug Plug-in in Microsoft Dynamics CRM 4

Plug-ins are one of the fundamental points in CRM. Using this extension mechanism, we can add any business logic over our CRM solution. However, test and debug it is usually harder, since this assembly will be integrated in the server. Here are shown several options to drive this problem:

  • DevErrors in web.config: This configuration setting indicates what kind of error will be showed to the end user. By default, it will be a generic error without any information. If we enable this setting, we’ll get a more useful error page.

How to modify the Web.config file to show more detailed error messages in Microsoft CRM

  • Enable trace generated by CRM platform. From the register. In this article you can find the keys that you need to update:

How to enable tracing in Microsoft Dynamics CRM

To manage these traces easily, we have several tools:

  • Trace File Viewer: a extension for the Stunnware Tool to visualize easier the traces files generated by the platform

Stunnware Tools for Microsoft Dynamics CRM 4.0 - Trace File Viewer (free extension)

IMPORTANT NOTE: This trace are enabled for all the organisation and all users, so the performance of our system will be affected considerably. Remember to disable when you finish.

  • Custom Traces from inside of our plug-ins: without doubts, this is the cooler options, since we could even test live environment. The idea is create a trace entity in CRM which can be accessed like another entity. So, you can check the traces by web interface, outlook, web services, …. A very good example of implementation for this idea can be found in the framework of David Jack, which is described in his great book CRM as a Rapid Development Platform. You can read more and download the code from this site: http://www.thecrmbook.com/. In addition, in this framework he’s also developed another cool windows application tool “Plug-in Test Harness” to test a plug-in simulating that it has been registered in CRM, but without really need it.

Finally, we could debug our code step by step using Visual Studio:

  1. Copy the .pdb file, which is together with our generated dll in Debug folder, to C:\Program Files\Microsoft Dynamics CRM Server\Server\bin\assembly
  2. In Visual Studio, we go to Debug->Attach to Process
  3. Selected "w3wp.exe":

Publicado 16 abril 09 11:04 por rtebar
Archivado en: ,,,

Comentarios

# Topics about Microsoft » Trace and Debug Plug-in in Microsoft Dynamics CRM 4 said on abril 18, 2009 21:11:

PingBack desde http://microsoft.linkedz.info/2009/04/16/trace-and-debug-plug-in-in-microsoft-dynamics-crm-4/

No se permiten comentarios de usuarios anónimos

About rtebar

Microsoft Dynamics CRM Developer and Consultant in Alfapeople Ltd (London)

Search

Go

Sindicación