a11smiles
a11smiles

Reputation: 1258

AccessViolationException caused by Workflow.Invoker

I have approximately 12,000 records.

In one of my workflow activities, I interate through all 12,000 records and manually call another Activity on each record.

The line looks like:

IDictionary<string, object> results = WorkflowInvoker.Invoke(childActivity, args);

On about the 11,500th record, I get AccessViolationException with the message that I've reached protected memory.

I can see the memory consumption rising in the Task Manager's Performance tab.

How do I keep the above code from increasing memory on each record interation ultimately conserving memory?

Thanks, Joshua

Upvotes: 0

Views: 158

Answers (1)

user1228
user1228

Reputation:

You're invoking a brand new workflow within a different workflow?

Ditch this. Create a NativeActivity and within the Execute method schedule your child Activity (that workflow) using NativeActivityContext.ScheduleFunc. In the callback, do what you need to with the result and then schedule the next record.

Upvotes: 1

Related Questions