One fundamental point in CRM are the plug-ins. With 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:
- Crm Diagnostic Tool: Windows application to enable and manage the trace options, instead access directly to the register:Β
CrmDiagTool4 for Microsoft CRM 4.0 has been released
- 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:
- 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
- In Visual Studio, we go to Debug->Attach to Process
- Selected "w3wp.exe":