While running the DU framework bot it is showing the below error in WaitForDocumentValidation Action Resume activity throwing below exception.
System.Runtime.Serialization.InvalidDataContractException: Type ‘System.Data.DataRow’ cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required. at System.Activities.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)
I remember this issue when I used parallel for each on data table, which cannot be serialized.
Finally I used Parallel loop on the list and problem disappeared.
But i am using simple for each only for the same
Any chance you’ve used a type which is not serializable? These usually trigger errors when creating the validation tasks.
Yes I have datatable variable and database connection variable but i already serialized the both variable
The issue indicates a problem with serialization - maybe try to see whether it’s about that?
In the .xaml file where you have the Wait for Action and Resume activities, all variables / arguments must be of data types that are serializable (e.g. simple types like strings, integers, arrays of strings are generally ok).
You might try using a List or Dictionary to store the attributes you’re currently storing in the DataTable, and see how it goes.
Currently instead of datatable i used array of string due to serialization because from database i need to iterate each and every value and then i need to process this value in DU processing
Yes but even if you’re not using DataTable variables in your code, the variables must not exist in the workflow either even if unused. You’ll need to try to clean up the variables one by one in your workflow to see which one is causing the serialization issue.