[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.
Related Issue
Didn't find any ?
Types of changes
- Docs change / refactoring / dependency upgrade
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to change)
Checklist
- My change requires a change to the documentation.
- I have added tests to cover my changes.
- All new and existing tests passed.
Pinging @IXLLEGACYIXL and @manio143 to take a look into this.