You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DataContractAttribute compatibility should not require IgnoreDataMember #18
When a class has a [DataContractAttribute] on it, members lacking any [DataMember] attribute should not be serialized, but members with that attribute should be. Instead, MessagePack throws an exception because it requires every member to be explicitly a [DataMember] or [IgnoreDataMember].
For compatibility with existing data contracts where adding attributes is not an option, we should fix MessagePack to accept the same kind of types that the DataContractSerializer and Newtonsoft.Json would.
no existing resolver can simulate DataContractSerializer.
ex:
[DataContract]
public class Master {
[DataMember]
public string A { get; set; }
[DataMember]
internal Detail B { get; set; }
}
public class Detail {
public string B1 { get; set; }
internal string B2 { get; set; }
}
in DataContractSerializer, include A and B1.
in ContractlessStandardResolver, only A.
in ContractlessStandardResolverAllowPrivate, include A and B1 and B2, it's too much.
When given this, the DynamicObjectResolver throws an exception. This behavior is also specified in the README. This issue tracks removing the exception and ignoring the unattributed member.
OK, I think I understand the point you're making now, @fredliex. Thanks for calling out the additional differences in behavior. It's probably worth fixing. But I'd like to track the additional compatibility issues as a separate issue.
Activity
AArnott commentedon Dec 16, 2018
See also MessagePack-CSharp#292 where this issue was reported on the upstream project.
fredliex commentedon Dec 16, 2018
hi @AArnott,
no existing resolver can simulate DataContractSerializer.
ex:
in
DataContractSerializer, include A and B1.in
ContractlessStandardResolver, only A.in
ContractlessStandardResolverAllowPrivate, include A and B1 and B2, it's too much.What do you think?
AArnott commentedon Dec 16, 2018
I don't understand what you're suggesting here, and your example doesn't match the scenario that this issue is about, which is this:
When given this, the
DynamicObjectResolverthrows an exception. This behavior is also specified in the README. This issue tracks removing the exception and ignoring the unattributed member.AArnott commentedon Dec 16, 2018
OK, I think I understand the point you're making now, @fredliex. Thanks for calling out the additional differences in behavior. It's probably worth fixing. But I'd like to track the additional compatibility issues as a separate issue.