Windows SharePoint Services 3.0 - SharePoint workflow instances that contain an OnTaskCreated activity do not rehydrate or fail with an EventDeliveryFailedException


SharePoint workflow instances that contain an OnTaskCreated activity do not rehydrate or fail with an EventDeliveryFailedException


Cause 1: Delay activity before OnTaskCreated
Description: The workflow contains a delay activity to dehydrate and persist task creation. Because there are issues with delays without .Net3.5 SP1 and the WSS infrastructure update, it makes it looks like OnTaskCreated never gets called

Cause 2: Untimely Dehydration in .Net 3.0 SP1+
Description: Workflows dehydrate for a full interval after the completion of the task creation activity and before the event handler code is run, which makes it look like some handlers are not being executed. 

Cause 3: Outdated workflow assembly cached in timer process
Description: Updating a workflow assembly in the GAC without restarting OWSTimer will cause the cached version of the workflow assembly to be out of date from the workflow assembly IIS started the workflow with and crash at the first workflow persistence point.  This appears as if the most recent batch of tasks never hits their event handler.

Cause 4: Correlation and task ID issues
Description: The workflow re-uses correlation tokens and task IDs for activities that require separate correlation tokens and IDs.  This causes the workflows to crash at the point where duplicate tokens are used.

Cause 5: Workflow code operates against an uncommitted task
Description: Referencing a task through the object model before it has committed to the content database causes an incorrect ID to be returned

Cause 6: 100 history item limit on workflow status page makes it appear as if subsequent events did not fire
Description: There is a 100 item limit for what history entries are displayed on the workflow status page.  This makes it appear like the event handlers stop firing after a while. 


Solution 1:
Install the infrastructure update located at

Solution 2: Wait five to ten mins for the workflow timer job to execute.

Solution 3: Restart the SharePoint Timer process

Solution 4: Only re-use these identifiers to correlate activities that map to the same task object.  Make sure different instances of the same task activites such as CreateTask use different correlation tokens and task IDs. 
Make sure that the task id property of the OnTaskCreated activity is set and initialized to a new guid.
If nested inside a scope such as a sequence, make sure the correlation token has an owner activity of that scope rather than the parent workflow.  When initializing the task ID guid for a task activity, create this guid outside of the scope in which the OnTaskCreated subscription is created.

Solution 5: Make sure code that references tasks directly executes after an activity that will persist the workflow state.

Solution 6: Log fewer history items, or check the complete list entries by browsing to the history list directly


Article ID: 2288782 - Last Review: Aug 1, 2010 - Revision: 1