Should you be using a .NET 4.5 plugin or custom workflow activity in MSCRM 2011 Online?

Short answer: Probably not.

More longwinded answer:

Note: This applies specifically to CRM 2011 Online.

This week I was creating what I thought would be a nice quick and easy custom workflow activity, however when I first tried to add the activity in the workflow designer I was presented with a System.Xaml.XamlObjectReaderException, that had the inner fault System.TypeLoadException, unfortunately CRM didn’t present the inner exception for that.

As a side note; presuming that my code was at fault I unregistered the custom workflow activity, but the error remained (this happened a couple of times). Workflows were not editable and a number no longer functioned in that environment for at least 3-4 hours (I always received the same error described above). After around half a day later the error would disappear and functionality would return to normal – a strange quirk which I assume was linked to some regular event in the system.

So I got on the blower to Microsoft where Maria was kind enough to provide me with the full error log, apparently I was suffering from a TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib'. That message led me to this StackOverflow question, the gist of which is that running .NET 4.5 code on .NET 4 machines can sometimes go horribly wrong.

Confusingly this MSDN article did state that: “If you plan to register your custom workflow activities with Microsoft Dynamics CRM Online, you must build them using the Microsoft .NET Framework 4 PU3 (platform update 3) or a later version, such as .NET 4.5.”

Which was subsequently updated to: “To develop Windows Workflow Foundation 4 custom activities, you must develop them on Microsoft .NET Framework 4. If you plan to register your custom workflow activities with Microsoft Dynamics CRM Online, you must build them using the Microsoft .NET Framework 4  PU3 (platform update 3) or a later version, such as .NET 4.5.

The later statement is still pretty confusing if you ask me, so I sought this clarification which was confirmed by Maria from Microsoft.

  • The CRM Online servers only have .NET 4 installed.
  • We can write code using .NET 4.5 as long as it is all backwards compatible with .NET 4.
  • It’s easier to use .NET 4 as compatibility issues can be avoided.
Advertisements

3 thoughts on “Should you be using a .NET 4.5 plugin or custom workflow activity in MSCRM 2011 Online?

  1. You had to phone Microsoft to get the inner exception details?

    Is there no tracing/logging facility with CRM online?

    • It depends where the error occurs, if the error was occurring in my code (plugin) as it ran there are tracing/logging facilities which give more detail (http://msdn.microsoft.com/en-us/library/gg328574.aspx).

      However as it was effectively occurring in CRM code you get a limited form of logging. I received the initial error (in a popup window) message plus its internal error. But not the internal error of the internal error. For the full error logs (as you would get on premise) I had to ask Microsoft to provide them. This is the only time I’ve ever had to do this as errors don’t usually occur there.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s