[Serialization] Fix diverging rules for editor and runtime serialization of fields and properties by Eideren · Pull Request #1875 · stride3d/stride (original) (raw)

PR Details

Prevent serializing get-only properties without backing field.

The idea here is that they aren't safe enough to serialize by default since they are functions, getting the value may throw, and since they do not provide a setter to create a value if the getter ever throws, we decided to only include them if the user decorates them with a [DataMember]

Diverging rules between runtime and editor serialization

Yaml can now serialize internal fields if decorated with DataMember, reflecting how serialization and filtering works for properties.
Binary includes properties with internal getters, as long as they are decorated with DataMember as well.

Those two changes were required to ensure that both serializer behaved in the same way.

Didn't find any ?

Types of changes

Checklist

Pinging @IXLLEGACYIXL and @manio143 to take a look into this.