Closed tcortega closed 8 months ago
I think - judging by the coverage report - that this breaks Dictionary serialization? Specifically referring to this report, because the check for Dictionary comes after the check for IEnumerable, and Dictionary inherits from IEnumerable. Not sure why the tests still pass though, that's a little strange.
I think - judging by the coverage report - that this breaks Dictionary serialization? Specifically referring to this report, because the check for Dictionary comes after the check for IEnumerable, and Dictionary inherits from IEnumerable. Not sure why the tests still pass though, that's a little strange.
This happens indeed because the IDictionary<,>
inherits from ICollection<T>
which inherits from IEnumerable<T>
. This means that it'll get the dictionaries enumerator and deserialize/serialize it, item by item, reading the KeyValuePair
s.
Now the question that is left is, this approach works fine, however, it might be slower than the old serializer, I didn't benchmark it but it probably is. Do you want me to move the condition for the dictionary check to be above it?
I'm not only concerned about the speed, I'm also concerned that it'll likely serialize differently - I'd imagine it'd serialize as a table array with each table having a key and value field, instead of as a table. So yeah please move the check up.
@SamboyCoding Thanks for implementing this.
Adds basic IEnumerable support for deserialization and serialization. Treats IEnumerable de/serialization as if they were collection types.
I could not find a way to only commit what I've changed in the
TestResources.resx
but I hope this isn't a problem.