Open hymerman opened 8 years ago
Are you using the standard mode for BinaryX20? It should handle cycles/serializing by reference. (See comments on SetMode function in BinaryX20.cs).
But you mentioned 'Guid', which is a struct, it's been a while maybe I'm not handling cycles for structs... Anyway, the way to handle that is check for cycles in the serializer code - or a much simpler way is to write a custom serializer to write/read Guid objects (e.g. StrongSerializer
Let me know how that goes.
Thanks for getting back to me!
Yes, this is using BinaryX20
in standard mode. And you're right, Guid
and TimeSpan
are both structs - so I imagine there's no cycle checking code for structs.
I don't think I'm confident enough with the internals of VFW to implement that yet so I had a go at adding custom serializers for both, and that seems to have done the trick - thanks!
I'll leave it up to you to decide whether to leave this issue open to track struct cycle checking, or just close it :)
I'm finding that serializing any object that has a field of its own type causes
ReflectiveComponentSerializer
to recurse infinitely. This is usingVexe.FastSave.Save.ObjectToMemory
to save some objects.For example,
System.TimeSpan
which has a fieldpublic static readonly TimeSpan Zero
, orSystem.Guid
which has a fieldpublic static readonly Guid Empty
, both trigger this behaviour.I'd expect this behaviour if there genuinely were circular references (though even then it would be nice to detect!), but for these static readonly members it seems maybe easy to avoid.
Can you point me in the right direction to figure out how to fix this?