Search code examples
c#wcfworkflow-foundation-4workflow-activity

Workflow Foundation - Multiple Bookmarks in Sequential Workflow


I am having trouble with multiple bookmarks in a WCF Windows Workflow Application.

The problem is that I am not able to resume more than one bookmark. When I attempt to resume the second bookmark the workflow I am receiving a BookmarkResumptionResult of NotFound. If I attempt to resume the bookmark again I get an InstanceLocked Exception.

It appears that the initial bookmark is still persisted to the Workflow Database.

Furthermore, this issue only appears to happen when I am executing an activity before the resumption of a bookmark.

Stranger still is that I can execute as many activities as I want that do not have an OutArgument. Once I have an OutArgument or a NativeActivity with a Result it appears that the initial bookmark is still persisted and I cannot continue with my workflow. If I have a simple activity with no Result or OutArgument that writes to the database or does something simple I am able to resume as many bookmarks as I want.

Below is some information about my environment:

  1. I am running the workflow as a WCF NT service.
  2. I am using the WorkflowApplication class to manage my workflows
  3. The WorkflowApplication instance is configured as

    a. PersistableIdle event is PersistableIdleAction.Unload

    b. Everything else is pretty much bare bones

  4. The workflow service behavior WorkflowIdleBehavior has a TimeToUnload of new TimeSpan(0, 0, 0)

I am still fairly new to WWF (as well as posting on SO) and hope I included enough information, please let me know if there are any specifics needed.

Thank you in advance for your help!


Solution

  • The issue that was occurring was that my activity was returning an Entity Framework model.

    I solved this problem by returning a Data Transfer Object with properties containing the values I needed.