-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EntitySerializer can write properties but ignores them when reading #28
Comments
I've run into the same issue. I've discovered that JsonSerializer from Change the enclosing (container) type from struct to class and everything will work fine. But IComponent implementer must be a struct in the end. |
I checked this issue when it was new but forgot to reply. IMHO support of properties has only low prio. |
One of my components has a field of my custom Anyway, I think it's not a problem for me to rewrite my struct to use By the way, what are the benefits of Friflo.Json serializer over, for example, System.Text.Json? |
When starting Maybe I change serialization to |
I tend to lean towards using auto properties, so that's what I did when I started making components. Because they serialized ok, it took me a while before I realized they were not being deserialized. After much debugging, I came to the conclusion stated in the title.
I was unsure if this was a bug that properties do not get deserialized or if properties are not actually supported and it's a fluke that they get serialized. Wither way, I figured I'd write a issue about it.
My observations are as follows.
For the following component...
I perform the following...
And it produces the following output...
Observe how the property value of
Foo.Value
is written to JSON as25
as declared when added to the entity. However when accessing said value from a newEntityStore
that the serialized entity was read into, it is now0
.But if I make the simple change and make the property a field instead like so...
The output is as follows...
The text was updated successfully, but these errors were encountered: