elsa-core/test/unit/Elsa.Workflows.Core.UnitTests/Extensions
Sipke Schoorstra 6503c0cb92
fix(workflows): resolve GetInput serializer options per host (#8158)
* fix(workflows): resolve GetInput serializer options per host

Remove the process-wide JsonSerializerOptions cache from ExpressionExecutionContextExtensions so DI converters registered on a later host remain visible after the first GetInput. Share CloneForValueConversion with WorkflowInstanceStorageDriver reads.

Closes #8131

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* fix(workflows): match storage write/read JSON reference semantics

Use the same cloned payload-serializer options for WorkflowInstanceStorageDriver Write and Read. Forcing ReferenceHandler.Preserve on read only treated ordinary $ref properties as metadata and broke restore.

Closes the P1 on #8158.

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* fix(workflows): serialize storage values by runtime type

SerializeToNode(object, options) used the compile-time object converter, so PolymorphicObjectConverter wrapped arrays as _items metadata. Write now uses the runtime type with the same cloned host options as Read.

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* test(workflows): assert stored array conversion is non-null

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* fix(workflows): restore _type for object-typed storage values

Serialize object-typed variables through the polymorphic converter so aliased CLR types keep a _type discriminator. Typed arrays still serialize by runtime type so they stay JSON arrays.

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* fix(workflows): deserialize object variables through polymorphic options

ConvertTo(object) returns the stored JsonObject because it is assignable to object. Read object-typed variables with the payload serializer so _type restores the concrete CLR type.

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-09-14 19:07:24 +02:00
..
ActivityExecutionContextExtensions fix(core): a fault a container claimed is not an incident (#7923) 2026-08-12 05:20:22 +02:00
ExpressionExecutionContextExtensions fix(workflows): resolve GetInput serializer options per host (#8158) 2026-09-14 19:07:24 +02:00