GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Using the JsonReader with the DataContractResolverStrategy the serializers does not seem to serialize into the ExtensionDataObject if the contract implements IExtensibleDataObject.
In terms of code:
using (StreamReader reader = new StreamReader("some stream here"))
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(SomeContract));
var serializedItem = (SomeContract)serializer.ReadObject(reader.BaseStream);
JsonReader jsonReader = new JsonReader(new DataReaderSettings(new DataContractResolverStrategy()));
var otherSerializedItem = jsonReader.Read<SomeContract>(reader.ReadToEnd());
The serializedItem and otherSerializedItem will not be the same as the serializedItem will have all the unknown values in the ExtensionDataObject defined in the contract.
I don't know if this would be a desired feature, an option to the resolver strategy or whatnot - but I find it odd that the two produces different results (and I for one finds it a usefull feature).