Bug when Deserializing Optional wrapped records

Hi,
built-in Deserialize node does not correctly handle Optional<> values.

The concrete values of wrapped records are lost during this process.

See included patch.

OptionalSerializationBug.vl (11.9 KB)

This happens both when the Optional value is used alone or when it is an internal property of another record that is being Serialized and Deserialized.

As per @Elias , there is the option to use the FSPickler or MessagePack serialization libraries as an alternative.

Both of these do not exhibit this bug and Serialize/Deserialize Optional values correctly.

Scratch that, all three serialization tools exhibit issues with Optional types, although different:

Built-in serializer: Loses inner value details but no error
MessagePack: Correctly serializes inner value but fails to represent NoneValue on deserialization
FSPickler: Correctly serializes inner value, fails to serialize an Optional with No Value

Built-in and MessagePack should deal with optional correctly in upcoming preview. Didn’t touch FSPickler, bit rusty on F#.

@Elias MessagePack seems to work great, thank you!

Regarding System.Serialization, there is still a remaining issue with serializing nested optional fields in preview 7.0 81.

The field ends up with NoValue.

Test patch here:
OptionalSerializationBug-Nested.vl (61.8 KB)

Thanks. Added to tests as well. Fixed in latest preview.

2 Likes