Wait for Form Task and Resume Throwing Error

Hi,

After successfully creating Form Task, the “Wait for Form Task and Resume” activity is throwing below error. Any help on this would be much appreciated.

Message: Type ‘System.Collections.IEnumerable’ 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.

Exception Type: System.Runtime.Serialization.InvalidDataContractException

RemoteException wrapping System.Runtime.Serialization.InvalidDataContractException: Type ‘System.Collections.IEnumerable’ 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)

Hy @PrafullK,

One suggestion: if you are working with human in the loop you cannot put it in a different workflow and call it on main. It MUST be on main, can you try that?
It happened to me, this error message is crazy and does not help at all!

Regards

1 Like

Hi @PrafullK,
All workflow variables in the same scope of persistence points in a workflow (wait and resume* activities ) should be serializable as mentioned here https://docs.uipath.com/studio/docs/orchestration-process#section-best-practices
If there are such non-serializable variables in the same scope of ‘wait for task and resume’, consider moving them to a different scope or a secondary workflow.
Thanks

1 Like

Thanks for the suggestions. It worked for me. :slight_smile:

Hi,

Trying to use “Wait for all form task completion.xaml” snippet. It is able to create all the tasks but when it is coming to second loop where it should execute “Wait and Resume For All Tasks” loop, it is throwing below error-

Message: Type ‘Newtonsoft.Json.Linq.JToken’ is a recursive collection data contract which is not supported. Consider modifying the definition of collection ‘Newtonsoft.Json.Linq.JToken’ to remove references to itself.

Exception Type: System.Runtime.Serialization.InvalidDataContractException

RemoteException wrapping System.Runtime.Serialization.InvalidDataContractException: Type ‘Newtonsoft.Json.Linq.JToken’ is a recursive collection data contract which is not supported. Consider modifying the definition of collection ‘Newtonsoft.Json.Linq.JToken’ to remove references to itself.
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)

@PrafullK Can you please let me know , how you made it work?

@shetanshudhar

  1. Use the “Wait for Form Task” activity in Main.xml only
  2. The scope of all the variables used with the workflow should be on top.

I just followed these two things (as suggested by @William_Blech_Sister and @Liji on above posts) and my issue got resolved.

you mean you put everything inside the flowchart of main.xaml. correct? I did the same still getting the error. :frowning:

Hi William, but how to use it on the main page when I need it in the for each row or for each parallel?