{"action":"created","issue":{"url":"https://api.github.com/repos/neuecc/MessagePack-CSharp/issues/166","repository_url":"https://api.github.com/repos/neuecc/MessagePack-CSharp","labels_url":"https://api.github.com/repos/neuecc/MessagePack-CSharp/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/neuecc/MessagePack-CSharp/issues/166/comments","events_url":"https://api.github.com/repos/neuecc/MessagePack-CSharp/issues/166/events","html_url":"https://github.com/neuecc/MessagePack-CSharp/issues/166","id":274432886,"number":166,"title":"How to use NativeDateTimeResolver, anonymous type of object type property.","user":{"login":"KatsuYuzu","id":2058878,"avatar_url":"https://avatars2.githubusercontent.com/u/2058878?v=4","gravatar_id":"","url":"https://api.github.com/users/KatsuYuzu","html_url":"https://github.com/KatsuYuzu","followers_url":"https://api.github.com/users/KatsuYuzu/followers","following_url":"https://api.github.com/users/KatsuYuzu/following{/other_user}","gists_url":"https://api.github.com/users/KatsuYuzu/gists{/gist_id}","starred_url":"https://api.github.com/users/KatsuYuzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KatsuYuzu/subscriptions","organizations_url":"https://api.github.com/users/KatsuYuzu/orgs","repos_url":"https://api.github.com/users/KatsuYuzu/repos","events_url":"https://api.github.com/users/KatsuYuzu/events{/privacy}","received_events_url":"https://api.github.com/users/KatsuYuzu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-11-16T08:34:17Z","updated_at":"2017-11-16T10:09:37Z","closed_at":null,"author_association":"NONE","body":"How to use `NativeDateTimeResolver` , anonymous type of object type property.\r\n\r\n```csharp\r\nCompositeResolver.RegisterAndSetAsDefault(\r\n    NativeDateTimeResolver.Instance,\r\n    ContractlessStandardResolver.Instance);\r\n\r\n// object !!\r\nobject expected = DateTime.Today;\r\n\r\nvar anonymouse = new { Value = expected };\r\n\r\nvar bin = MessagePackSerializer.Serialize(anonymouse);\r\n\r\nvar result = MessagePackSerializer.NonGeneric.Deserialize(anonymouse.GetType(), bin);\r\n\r\nvar actual = result.GetType().GetProperty(\"Value\").GetValue(result);\r\n\r\n// expected: 2017/11/16 00:00:00\r\n// actual  : 2017/11/15 15:00:00\r\n// NativeDateTimeResolver not working.\r\nAssert.AreEqual(expected, actual);\r\n```"},"comment":{"url":"https://api.github.com/repos/neuecc/MessagePack-CSharp/issues/comments/344876217","html_url":"https://github.com/neuecc/MessagePack-CSharp/issues/166#issuecomment-344876217","issue_url":"https://api.github.com/repos/neuecc/MessagePack-CSharp/issues/166","id":344876217,"user":{"login":"KatsuYuzu","id":2058878,"avatar_url":"https://avatars2.githubusercontent.com/u/2058878?v=4","gravatar_id":"","url":"https://api.github.com/users/KatsuYuzu","html_url":"https://github.com/KatsuYuzu","followers_url":"https://api.github.com/users/KatsuYuzu/followers","following_url":"https://api.github.com/users/KatsuYuzu/following{/other_user}","gists_url":"https://api.github.com/users/KatsuYuzu/gists{/gist_id}","starred_url":"https://api.github.com/users/KatsuYuzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KatsuYuzu/subscriptions","organizations_url":"https://api.github.com/users/KatsuYuzu/orgs","repos_url":"https://api.github.com/users/KatsuYuzu/repos","events_url":"https://api.github.com/users/KatsuYuzu/events{/privacy}","received_events_url":"https://api.github.com/users/KatsuYuzu/received_events","type":"User","site_admin":false},"created_at":"2017-11-16T10:09:37Z","updated_at":"2017-11-16T10:09:37Z","author_association":"NONE","body":"Thank you, MyCompositeResolver is worked !!\r\n\r\nI tried Typeless.\r\nBut, type of deserialized anonymous type is Dictionary<object, object>.\r\nIs this a specification?\r\n```C#\r\npublic class Test { public object Value { get; set; } }\r\n\r\n[TestMethod]\r\npublic void TestMethod1()\r\n{\r\n    CompositeResolver.RegisterAndSetAsDefault(\r\n        new[] { new DynamicObjectTypeFallbackFormatter(MyCompositeResolver.Instance) },\r\n        new[] { MyCompositeResolver.Instance });\r\n\r\n    // object !!\r\n    object expected = DateTime.Today;\r\n\r\n    var anonymouse = new { Value = expected };\r\n\r\n    // NativeDateTimeResolver is worked !!\r\n    var bin = MessagePackSerializer.Typeless.Serialize(anonymouse);\r\n\r\n    // exception: Invalid primitive bytes.\r\n    var result = MessagePackSerializer.Deserialize<Test>(bin);\r\n\r\n    // actual\r\n    // Dictionary<object, object> result = MessagePackSerializer.Typeless.Deserialize(bin);\r\n}\r\n```"}}
{"actor":{"display_login":"KatsuYuzu"}}