elsa-workflows / elsa-workflows/elsa-core
[Bug] ELSA 3.2.1 Serialization of workflow instances / Object list properties with MongoDb no longer working, circular references...
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
## Description
I have created a custom function `findEntities `which returns a `List` within Jint engine.
With Version ELSA 3.2, I can call the function within a JavaScript activity. The result can be persisted within a variable using
the `setVariable(..)` method. For example:
`setVariable("MyArray", findEntities("x => x.Template != null"));`
The MyArray variable is correctly persisted within the WorkflowState.
After update to Version ELSA 3.2.1, this leads to Maximum serialization depth exceeded within WorkflowInstance persistence...
Refer to attached log file...
`Error: An error occurred while serializing the WorkflowState property of class Elsa.Workflows.Management.Entities.WorkflowInstance: An error occurred while serializing the ActivityExecutionContexts property of class Elsa.Workflows.State.WorkflowState: An error occurred while serializing the Properties property of class Elsa.Workflows.State.ActivityExecutionContextState: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: An error occurred while serializing the Parent property of class System.Text.Json.Nodes.JsonNode: Maximum serialization depth exceeded (does the object being serialized have a circular reference?).'`
**At the moment, within ELSA 3.2.1 it is impossible to persist any arrays within a workflow instance variable**
Are the any breaking changes within WorkflowInstance Persistance? Critical bug?
## Steps to Reproduce
Try to store an array property using the JavaScript activity and the setVariable method. For example
- Add JavaScript activity to workflow
- Create the Variable: MyArray with type object and WorkflowInstance persistance
- Call script:
```
let myArray = ([
1,2,3,4,5,6
])
setVariable("MyArray", myArray);
```
**Reproduction Rate**:
- No error with ELSA 3.2
- Always with ELSA 3.2.1
Contributor guide
Assessment
This issue has not been assessed yet.