When using persistence activities (Wait and Resume type activities), an error is received.
This is a Microsoft .NET Framework logic limitation.
Any non-serializable workflow variables should not reside in the same scope of persistent points of a workflow (which is any "Wait and Resume" type activities).
- The best practice would be to separate out such non-serializable data from the same scope of "Wait and Resume" activities by using different sequences or secondary workflow files.
More about serialization can be read in the Microsoft .NET Framework documentation: Serialization in .Net .