Error on wait for form task and resume

Hello!

I’m getting the following error when run the activity “wait for form task and resume”:

"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.

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)"

I search here and found the link below with the similar error, tried the solution of this issue, but the error persists.

My environment is:

  • Windows Server 2016 Standard
  • .NET Framework v4.0.30319
  • UiPath Studio 2021.10.4
  • Project type: Windows Legacy
  • Project Properties: Starts in background, Supports Persistence and Modern Design Experience enabled
  • Dependencies of this project:
    • UiPath.Excel.Activities = 2.11.4
    • UiPath.Form.Activities = 1.8.0
    • UiPath.Form.ActivityLibrary = 1.8.0
    • UiPath.Mail.Activities = 1.12.3
    • UiPath.Persistence.Activities = 1.3.2
    • UiPath.System.Activities = 21.10.4
    • UiPath.UIAutomation.Activities = 21.10.5
    • UiPath.WebAPI.Activities = 1.9.2

Thanks a lot,

Hi @rpa2512 ,

I do believe the reason is due to the presence of a Non-Serializable variable type.

If you take a look at the Best Practices for a Long Running Process, we would need to keep all the Variables under it’s Scope to be a Serializable type.

You can find more details about it in the below Doc :

Hello @rpa2512, do you found solucion?
I had the same problem last friday and the solution for my case were separate the variables JObject in one sequence from main, in this case the part of my robot who use “wait for form task and resume” don’t see JObject and the project works.

To resolve the issue, remove any unused variable from your workflow where “wait for form …” activity resides.