简体   繁体   中英

Persist Activity fails in wf4 workflow

I am having a problem Persisting a workflow in wf4.

I cannot persist the workflow using the Persist Activity. Nor can I persist the workflow from a method contained in a class I have injected into the workflow which I then call from inside the workflow using an InvokeMethod activity

If I do:

workflowApp = new WorkflowApplication(new actBTX(), inParams);
workflowApp.Run();
workflowApp.Persist();    

in the factory method that creates the workflows then I can see the workflow persist.

I have tested my workflows to see if I am in a NoPersistZone using:

        var prop = context.Properties.Find("System.Activities.NoPersistProperty");
        IsInNoPersistScope.Set(context, prop != null);

and it seems I am not.

The fact that I can persist when I am 'outside' the workflow suggests to me that it is not a problem with the variable types that are in the workflow.

When persistence fails it stops the whole workflow dead if I use the Persist activity. The method call throws an exception:

 Exception: The operation did not complete within the allotted timeout of 00:02:00

Any ideas?

Ok We worked it out.

There is a data object that doesn't serialise nicely. When Persist hits it it crashes silently (which is a bad thing).

We suspect that workflowApp.Persist() works because the workflow is not fully initialized in the time between

workflowApp.Run();
workflowApp.Persist(); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM