Tuesday, July 1, 2008

Declarative workflows: Could not deserialize object. The type '' could not be resolved.

This is mainly a reminder for myself.
When you get this error
a) check that you've added a reference to the needed assembly using a type provider for your workflow
b) check the xml itself of your workflow: the namespace of the item that couldnt be deserialized is possibly incomplete. It needs to be a fully qualified namespace. And this is where the editor screws up a little if it's not in the GAC.

For example, the editor has a tendency to create only:
xmlns:ns0="clr-namespace:Company.Lib.Activities
but it should create
xmlns:ns0="clr-namespace:Company.Lib.Activities;Assembly=Company.Lib.Activities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

(it's missing the assembly qualifier in the namespace declaration, wich you need to resolve the activity). Not specifying version, culture and publickeytoken works just the same.

With these two tips you can generally resolve the 'Could not deserialize object'-errors.

1 comment:

Vladi Gubler said...

It happened to me when I left the DLL file in the bin folder, it caused the XOML to try to load the DLL without the public key token, it obviously was not found. Just removed the DLL from bin and recycled the app pool.

Vladi Gubler