{"action":"created","issue":{"url":"https://api.github.com/repos/msgpack/msgpack-cli/issues/62","labels_url":"https://api.github.com/repos/msgpack/msgpack-cli/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/msgpack/msgpack-cli/issues/62/comments","events_url":"https://api.github.com/repos/msgpack/msgpack-cli/issues/62/events","html_url":"https://github.com/msgpack/msgpack-cli/issues/62","id":55941863,"number":62,"title":"Unable to serialise class with non-settable collection","user":{"login":"nzbart","id":1592130,"avatar_url":"https://avatars.githubusercontent.com/u/1592130?v=3","gravatar_id":"","url":"https://api.github.com/users/nzbart","html_url":"https://github.com/nzbart","followers_url":"https://api.github.com/users/nzbart/followers","following_url":"https://api.github.com/users/nzbart/following{/other_user}","gists_url":"https://api.github.com/users/nzbart/gists{/gist_id}","starred_url":"https://api.github.com/users/nzbart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzbart/subscriptions","organizations_url":"https://api.github.com/users/nzbart/orgs","repos_url":"https://api.github.com/users/nzbart/repos","events_url":"https://api.github.com/users/nzbart/events{/privacy}","received_events_url":"https://api.github.com/users/nzbart/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/msgpack/msgpack-cli/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-01-29T19:05:13Z","updated_at":"2015-02-02T02:53:54Z","closed_at":null,"body":"Microsoft mandates that classes [must not expose](https://msdn.microsoft.com/en-us/library/dn169389%28v=vs.110%29.aspx) settable collection properties. I'm not aware of any classes in the BCL that violate this rule.\r\n\r\nUnfortunately, 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.\r\n\r\nBelow is a test that fails that I think should pass:\r\n\r\n```csharp\r\n    class CompliantClass\r\n    {\r\n        //compliant with Microsoft guidelines at https://msdn.microsoft.com/en-us/library/dn169389%28v=vs.110%29.aspx:\r\n        // \"X DO NOT provide settable collection properties.\"\r\n        public List<int> Integers { get; private set; }\r\n\r\n        public CompliantClass()\r\n        {\r\n            Integers = new List<int>();\r\n        }\r\n    }\r\n\r\n    //This test currently fails, but I would like it to pass\r\n    [Test]\r\n    public void Given_a_class_with_non_settable_list_property_When_serialised_with_msgpack_Then_no_exception_should_be_thrown()\r\n    {\r\n        SerializationContext.Default.GetSerializer<CompliantClass>();\r\n    }\r\n```\r\n\r\nIs there a way to get msgpack to support this style of class?"},"comment":{"url":"https://api.github.com/repos/msgpack/msgpack-cli/issues/comments/72400419","html_url":"https://github.com/msgpack/msgpack-cli/issues/62#issuecomment-72400419","issue_url":"https://api.github.com/repos/msgpack/msgpack-cli/issues/62","id":72400419,"user":{"login":"nzbart","id":1592130,"avatar_url":"https://avatars.githubusercontent.com/u/1592130?v=3","gravatar_id":"","url":"https://api.github.com/users/nzbart","html_url":"https://github.com/nzbart","followers_url":"https://api.github.com/users/nzbart/followers","following_url":"https://api.github.com/users/nzbart/following{/other_user}","gists_url":"https://api.github.com/users/nzbart/gists{/gist_id}","starred_url":"https://api.github.com/users/nzbart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzbart/subscriptions","organizations_url":"https://api.github.com/users/nzbart/orgs","repos_url":"https://api.github.com/users/nzbart/repos","events_url":"https://api.github.com/users/nzbart/events{/privacy}","received_events_url":"https://api.github.com/users/nzbart/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T02:53:54Z","updated_at":"2015-02-02T02:53:54Z","body":"I've upgraded to the latest NuGet package and run our unit tests. No problems identified. \r\n\r\nThanks for the quick turnaround!"}}