{"action":"created","issue":{"url":"https://api.github.com/repos/wojtpl2/ExtendedXmlSerializer/issues/205","repository_url":"https://api.github.com/repos/wojtpl2/ExtendedXmlSerializer","labels_url":"https://api.github.com/repos/wojtpl2/ExtendedXmlSerializer/issues/205/labels{/name}","comments_url":"https://api.github.com/repos/wojtpl2/ExtendedXmlSerializer/issues/205/comments","events_url":"https://api.github.com/repos/wojtpl2/ExtendedXmlSerializer/issues/205/events","html_url":"https://github.com/wojtpl2/ExtendedXmlSerializer/issues/205","id":360781914,"node_id":"MDU6SXNzdWUzNjA3ODE5MTQ=","number":205,"title":"Bug with circular dependencies","user":{"login":"FaustoNascimento","id":12008616,"node_id":"MDQ6VXNlcjEyMDA4NjE2","avatar_url":"https://avatars0.githubusercontent.com/u/12008616?v=4","gravatar_id":"","url":"https://api.github.com/users/FaustoNascimento","html_url":"https://github.com/FaustoNascimento","followers_url":"https://api.github.com/users/FaustoNascimento/followers","following_url":"https://api.github.com/users/FaustoNascimento/following{/other_user}","gists_url":"https://api.github.com/users/FaustoNascimento/gists{/gist_id}","starred_url":"https://api.github.com/users/FaustoNascimento/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FaustoNascimento/subscriptions","organizations_url":"https://api.github.com/users/FaustoNascimento/orgs","repos_url":"https://api.github.com/users/FaustoNascimento/repos","events_url":"https://api.github.com/users/FaustoNascimento/events{/privacy}","received_events_url":"https://api.github.com/users/FaustoNascimento/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2018-09-17T09:15:25Z","updated_at":"2018-09-19T16:31:27Z","closed_at":null,"author_association":"NONE","body":"Given the class...\r\n\r\n    public class Person\r\n    {\r\n        private IList<Person> _friends = new List<Person>();\r\n\r\n        public Person(string name)\r\n        {\r\n            Name = name;\r\n        }\r\n\r\n        public Person()\r\n        {\r\n        }\r\n\r\n        public string Name { get; set; }\r\n\r\n        public IList<Person> Friends\r\n        {\r\n            get => _friends;\r\n            set => _friends = value ?? throw new ArgumentNullException();\r\n        }\r\n    }\r\n\r\nAnd invoking it as such:\r\n\r\n           var snoopy = new Person(\"Snoopy\");\r\n            var charlieBrown = new Person(\"Charles \\\"Charlie\\\" Brown\");\r\n            var sallyBrown = new Person(\"Sally Brown\");\r\n            var marcie = new Person(\"Marcie\");\r\n\r\n            snoopy.Friends.Add(charlieBrown);\r\n            snoopy.Friends.Add(sallyBrown);\r\n            snoopy.Friends.Add(marcie);\r\n            snoopy.Friends.Add(charlieBrown); // added twice -- intentional\r\n\r\n           var serializer = new ConfigurationContainer().EnableParameterizedContent().EnableReferences().Create();\r\n            \r\n            var serializedPerson = serializer.Serialize(snoopy);\r\n            snoopy = serializer.Deserialize<Person>(serializedPerson);\r\n\r\nThe serialization will all work as expected, but an exception will be thrown on deserialization: \r\n\r\n    The value \"ExtendedXmlSerializer.ExtensionModel.Types.ActivationContext\" is not of type \"ExsTests.Person\" and cannot be used in this generic collection. Parameter name: value\r\n\r\nIf you comment out the last `Friends.Add` then the object will be properly deserialized *but* `snoopy` will be an empty object - no Friends, no Name. Please fix poor ol' Snoopy!"},"comment":{"url":"https://api.github.com/repos/wojtpl2/ExtendedXmlSerializer/issues/comments/422870004","html_url":"https://github.com/wojtpl2/ExtendedXmlSerializer/issues/205#issuecomment-422870004","issue_url":"https://api.github.com/repos/wojtpl2/ExtendedXmlSerializer/issues/205","id":422870004,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjg3MDAwNA==","user":{"login":"FaustoNascimento","id":12008616,"node_id":"MDQ6VXNlcjEyMDA4NjE2","avatar_url":"https://avatars0.githubusercontent.com/u/12008616?v=4","gravatar_id":"","url":"https://api.github.com/users/FaustoNascimento","html_url":"https://github.com/FaustoNascimento","followers_url":"https://api.github.com/users/FaustoNascimento/followers","following_url":"https://api.github.com/users/FaustoNascimento/following{/other_user}","gists_url":"https://api.github.com/users/FaustoNascimento/gists{/gist_id}","starred_url":"https://api.github.com/users/FaustoNascimento/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FaustoNascimento/subscriptions","organizations_url":"https://api.github.com/users/FaustoNascimento/orgs","repos_url":"https://api.github.com/users/FaustoNascimento/repos","events_url":"https://api.github.com/users/FaustoNascimento/events{/privacy}","received_events_url":"https://api.github.com/users/FaustoNascimento/received_events","type":"User","site_admin":false},"created_at":"2018-09-19T16:31:27Z","updated_at":"2018-09-19T16:31:27Z","author_association":"NONE","body":"Just a thought but ... how about creating 3 extensions for non-empty ctors?\r\n\r\nNot going to try to name them, 'cause I suck at that but ...\r\n\r\n- One extension that follows the rules of protobuf-net to the letter (the current one)\r\n- One extension that is slightly looser and simply demands that properties set via the ctor have no public setter\r\n- One extension that just doesn't care about public setters on any properties - even the ones set via the ctor.\r\n\r\nThe middle one would suffice for most classes and encourage immutability of properties set in the ctor (file FileInfo, FileStream - although the parameter names don't match property names, but that's a different issue), but for those cases where that is simply not enough (like mine) there's still the \"completely loose\" option."}}
{"actor":{"display_login":"FaustoNascimento"}}