Bug description
There is a problem with objects with inheritance. In this case I have virtual properties with DataMember attribute in base class. Then I have derived class with overridden properties for adding some custom attributes for these properties. It should work for standard DataContract serializer and for MessagePack serializer. But it only works for DataContract serializer.
Repro steps
Demo example:
[DataContract]
public class BaseClass
{
[DataMember]
public virtual int VirtualProperty { get; set; }
}
[DataContract]
public class DerivedClass : BaseClass
{
//[SomeCustomAttribute]
[DataMember]
public override int VirtualProperty { get; set; }
}
var obj = new DerivedClass {VirtualProperty = 100};
var bin = MessagePackSerializer.Serialize(obj);
var obj2 = MessagePackSerializer.Deserialize<DerivedClass>(bin);
Expected behavior
It should work as well as on DataContract serializer.
Actual behavior
I got exception:
MessagePack.Internal.MessagePackDynamicObjectResolverException : key is duplicated, all members key must be unique. type: MyLibTest+DerivedClass member:VirtualProperty
- MessagePack v.2.1.115
- Runtime: .Net Core 3.1, Visual Studio 2019.
Additional context
Is it possible to add support for this case?
I can delete DataMember attribute from property in base class. In this case MessagePack serializer start working, but DataContract serializer stops working.
Bug description
There is a problem with objects with inheritance. In this case I have virtual properties with
DataMemberattribute in base class. Then I have derived class with overridden properties for adding some custom attributes for these properties. It should work for standardDataContractserializer and forMessagePackserializer. But it only works forDataContractserializer.Repro steps
Demo example:
Expected behavior
It should work as well as on
DataContractserializer.Actual behavior
I got exception:
MessagePack.Internal.MessagePackDynamicObjectResolverException : key is duplicated, all members key must be unique. type: MyLibTest+DerivedClass member:VirtualPropertyAdditional context
Is it possible to add support for this case?
I can delete
DataMemberattribute from property in base class. In this caseMessagePackserializer start working, butDataContractserializer stops working.