elsa-core/test/integration/Elsa.Workflows.IntegrationTests/Serialization
Robin Sue c4a6ce2796 Fix Primitive Collection serialization
This was broken by both #5871 and #5682:
1. When a List<Guid> was serialized, it was recognized as a primitive collection and thus plainly written to the JSON without any type information: ["d4d8404c-4357-47ff-a343-649a116539f5"]
2. When this JSON was deserialized, due to lack of type info, it was deserialized as List<object>, containing strings. This is already not good.
3. When this List<object> gets serialized again (e.g. due to multiple workflow suspends causing WorkflowState serialization), this time it fails the primitive collection recognition, because object is not a primitive type. It now gets serialized as {"_items": ["d4d8404c-4357-47ff-a343-649a116539f5"], "_type": "Object[]"}
4. When that JSON gets deserialized, it tries to ReadType() but ReadType() fails to parse Object[] since it lacks the logic from TypeJsonConverter to throw away the [] before looking up Object in the WellKnownTypeRegistry, so it returns null as a type. Without a type but being faced with a json object { ... } it now deserializes into an ExpandoObject
5. Any further serialization / deserializations will now cause the expando object to get nested deeper and deeper every time.
2024-12-04 15:47:01 +01:00
..
ContainerSerialization Implement multitenant HTTP routing (#6031) 2024-10-14 21:27:11 +02:00
JsonSerialization Fix Primitive Collection serialization 2024-12-04 15:47:01 +01:00
Polymorphism Merge remote-tracking branch 'origin/patch/3.2.x' 2024-07-07 11:45:26 +02:00
ProgrammaticWorkflowsAndDelegates Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
SpecialPropertySerialization Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
VariableExpressions Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
VariableTypes Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00