Document Processing 20.4 Beta: Human-Robot Interaction using Action Center

Please use parallel for each instead.


Hi Team,

When the automation is going under Wait for document validation and resume activity then it is throwing an exception as mentioned below:

RemoteException wrapping System.Runtime.Serialization.InvalidDataContractException: Type ‘System.Net.Mail.AlternateViewCollection’ cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.Activities.WorkflowApplication.IdleEventHandler.OnStage2Complete(IAsyncResult lastResult, WorkflowApplication instance, Boolean isStillSync)
at System.Activities.WorkflowApplication.EventFrame(IAsyncResult result)

However, while running the code in Debug mode and applying a breakpoint on this activity and when it comes to this stage then I validate the results in orchestrator and continue the process then it is not giving any exception.

Please let me know how to resolve this error ASAP.

Hello @Gupta_Divya ,

You are using an AlternateViewCollection object in your workflow and that object is NOT serializable => cannot be used directly in a persistence workflow.

Workaround for this is to identify the part of your workflow that is using the mail collection, and isolate it into a separate workflow you can then invoke. This would ensure that that variable is NOT declared anywhere in the Main xaml and therefore your process can use the persistence activities.

Hope this helps,


1 Like


Please try replacing for each with parallel for each, it should resolve the issue.

Hi, I still have this issue. Do I need to check any other things