AqlaSolutions / AqlaSerializer

Binary serializer with full .NET support!
http://www.aqla.net
Other
17 stars 3 forks source link

Support for System.ValueTuple` #17

Closed aienabled closed 7 years ago

aienabled commented 7 years ago

There is no support for new ValueTuple (de)serialization. I've hacked my solution based on type.FullName check (where there are checks for System.Tuple) and commenting out this code:

if (!field.IsInitOnly) return null; // all public fields must be readonly to be counted a tuple
aienabled commented 7 years ago

By the way, it's very smelly that the method MetaType.ResolveTupleConstructor is actually used not only to resolve the tuple constructor, but for other types as well.

AqlaSolutions commented 7 years ago

Thank you, I'm going to add the support for .NET 4.7 later (and may be Core?), I even don't have VS 2017 installed yet...

AqlaSolutions commented 7 years ago

By the way, it's very smelly that the method MetaType.ResolveTupleConstructor is actually used not only to resolve the tuple constructor, but for other types as well.

It is used for AutoTuple feature where you can make your own tuple type and it will be auto-detected. As far as I remember tuples are expected to use only readonly properties - this is why it doesn't detect ValueTuple which uses writeable fields.

aienabled commented 7 years ago

By the way, it's very smelly that the method MetaType.ResolveTupleConstructor is actually used not only to resolve the tuple constructor, but for other types as well.

It is used for AutoTuple feature where you can make your own tuple type and it will be auto-detected. As far as I remember tuples are expected to use only readonly properties - this is why it doesn't detect ValueTuple which uses writeable fields.

In that case - all right. I just was confused by the name of the method. Isn't it should be ResolveAutoTupleConstructor then?

I will pull your commits to check the ValueTuple serialization right now.

aienabled commented 7 years ago

Yes, it works properly. Thanks!