I am very stuck on this and would appreciate any leads. I have a complex Visual Studio State Machine Workflow that sporadically errors out with no Unexpected error. All I see in ULS is:
Engine RunWorkflow: System.Workflow.Activities.EventDeliveryFailedExpection: Event "OnWorkflowItemChanged" on interface type "Microsoft.SharePoint.Workflow.ISharePointService" for instance id "*GUID*" cannot be delivered --> System.Runtime.Serialization.SerializationException: Cannot get the member 'MyCode_ToExecute'.
Online documentation has gotten me no where so I have been experimenting with what I believe is the problem. The suspects:
- There are class scoped variables in the workflow class that are set at the beginning of the workflow and are used through out each state to see if the items "Assigned To" value has changed. This variable is serialized and is used in the problem method 'MyCode_ToExecute'.
- There is an else condition in the state that is getting stuck. The else branch does not require a code condition be met, and does perform processing (check permissions) each time it is run.
- There are 2 content types in one list and each have their own workflow. We created a model class shared by both content types because they share common methods and properties. I noticed this error started happening after I refactored a method written twice in both of the workflows and started calling it from the model. The method is responsible for setting permissions on the item.
- I noticed that right before one items workflow failed, operations were queued. Warning was given: "Due to heavy load, the latest workflow operation has been queued. It will attempt to resume at a later time”. Even though the workflow was paused, the item was still being changed. I believe that when the queue finally got around to the workflow, the serialized item no longer matched the actual item.