Problem opening workflows in CRM GUI

Currently I am working on a project with a quite complex sales process and part of it is managed by workflows (for flexibility) and to be able to do what is needed, I have developed several custom workflow activities.

However, today I had just installed some stuff and was going to review one of the workflows, and the CRM GUI crashed with the Exception “System.NullReferenceException” in a really nasty way when I tried to open it. By looking at the stack trace I got a feeling it had something to do with my custom activities so I just reregistered them and then everything started working again. So if you come across this error, this might be the problem. I couldn’t find any reference to this error on the net why I thought it might be a good idea to blog about it.

Gustaf Westerlund
Microsoft Dynamics CRM Architect

Logica
www.logica.com

Automatic restart of Async Service

When developing new workflow activities for CRM 4.0 you need to release the filelocks on the dll to be able to copy the new dll to the assembly directory. This can of course be done manually by restarting the service in the service manager but can be scripted into the prebuild events aswell, so that it is more automatic. Add the following two lines to the Pre-build events of your workflow activity project to make it restart the MSCRMAsyncService:

net stop “MSCRMAsyncService”
net start “MSCRMAsyncService”

Please note that you might inflict any ongoing workflows by doing this so take care if it is a live production server.

Gustaf Westerlund
Microsoft Dynamics CRM Architect

Logica
www.logica.com