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 Orchestration Process
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?

Hi @ayyoub,

What I understood from my experience is that we need to create an Orchestration project and in that, in Main.xaml we need to use these activities (Create Form Task or Wait for Form Task and Resume).

They do work in for each but not together, we need to use them in separate loops. I have attached a snippet, hope it helps.

net45.zip (12.4 KB)

Hi Vamsi,

I followed your workflow. For each which you used for wait for form task and resume. For first loop its working for second loop it throws an error as " Object reference not set to an instance of an object". But there is the value. Can you guide me. how to fix this issue or please share the workflow.Thanks.

net45.zip (12.6 KB)

Please see the attached workflow. Need to use while loop for “wait for form task and resume”. I used for each loop earlier, my bad.

Hey, consider using Parallel for Each if you are waiting on multiple actions in the same job. There are snippets in studio under the category ‘Orchestration’ that demonstrates this

1 Like