-
Notifications
You must be signed in to change notification settings - Fork 173
Closed
Labels
bugDetected as bugDetected as bug
Description
Microsoft mandates that classes must not expose settable collection properties. I'm not aware of any classes in the BCL that violate this rule.
Unfortunately, msgpack doesn't serialise instances that comply with this rule. JSON.NET and System.Xml.Serialization.XmlSerializer both use the Add method on the collection to support non-settable collections.
Below is a test that fails that I think should pass:
class CompliantClass
{
//compliant with Microsoft guidelines at https://msdn.microsoft.com/en-us/library/dn169389%28v=vs.110%29.aspx:
// "X DO NOT provide settable collection properties."
public List<int> Integers { get; private set; }
public CompliantClass()
{
Integers = new List<int>();
}
}
//This test currently fails, but I would like it to pass
[Test]
public void Given_a_class_with_non_settable_list_property_When_serialised_with_msgpack_Then_no_exception_should_be_thrown()
{
SerializationContext.Default.GetSerializer<CompliantClass>();
}Is there a way to get msgpack to support this style of class?
Metadata
Metadata
Assignees
Labels
bugDetected as bugDetected as bug