How to load a workflow after pausing / saving it?

Using this MSDN article as an example for pausing and resuming, one would suggest that it would be quite simple. This is how I pause the workflow ...

LastWfGuid = workflow.Id;
workflow.Unload();

Quite simply, it should be stored in the instance store (which I already set before these two lines), and I see the entries in the Instance and InstancesTable views. When I am ready to resume the workflow, I do this ...

workflow = new WorkflowApplication( myActivity, myWfArgs );
workflow.InstanceStore = wfStore;
workflow.Load(LastWfGuid);

At this point, I am getting InvalidOperationExceptionan exception message ...

Workflow inputs cannot be used with Load or LoadRunnableInstance, since they are only provided to new instances.

If I cannot load a workflow that was previously saved, how can I resume it? I tried just downloading Persist()instead Unload(), and from the outside it looks fine, and I get no exception. But the workflow continues to work on this course, and this is not what I'm looking for. I want to pause and then resume my workflow.

+3
source share
1 answer

Remove the myWfArgs argument when creating the WorkflowApplication used to load an existing workflow instance. So like this:

workflow = new WorkflowApplication(myActivity);
workflow.InstanceStore = wfStore;
workflow.Load(LastWfGuid);
+3
source

Source: https://habr.com/ru/post/1750134/


All Articles