{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Blazor/issues/388","repository_url":"https://api.github.com/repos/aspnet/Blazor","labels_url":"https://api.github.com/repos/aspnet/Blazor/issues/388/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Blazor/issues/388/comments","events_url":"https://api.github.com/repos/aspnet/Blazor/issues/388/events","html_url":"https://github.com/aspnet/Blazor/issues/388","id":308732265,"number":388,"title":"SimpleJson Deserializing to struct error","user":{"login":"adeel41","id":13577,"avatar_url":"https://avatars1.githubusercontent.com/u/13577?v=4","gravatar_id":"","url":"https://api.github.com/users/adeel41","html_url":"https://github.com/adeel41","followers_url":"https://api.github.com/users/adeel41/followers","following_url":"https://api.github.com/users/adeel41/following{/other_user}","gists_url":"https://api.github.com/users/adeel41/gists{/gist_id}","starred_url":"https://api.github.com/users/adeel41/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adeel41/subscriptions","organizations_url":"https://api.github.com/users/adeel41/orgs","repos_url":"https://api.github.com/users/adeel41/repos","events_url":"https://api.github.com/users/adeel41/events{/privacy}","received_events_url":"https://api.github.com/users/adeel41/received_events","type":"User","site_admin":false},"labels":[{"id":794118843,"url":"https://api.github.com/repos/aspnet/Blazor/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/aspnet/Blazor/milestones/2","html_url":"https://github.com/aspnet/Blazor/milestone/2","labels_url":"https://api.github.com/repos/aspnet/Blazor/milestones/2/labels","id":3064358,"number":2,"title":"Backlog","description":"","creator":{"login":"danroth27","id":1874516,"avatar_url":"https://avatars2.githubusercontent.com/u/1874516?v=4","gravatar_id":"","url":"https://api.github.com/users/danroth27","html_url":"https://github.com/danroth27","followers_url":"https://api.github.com/users/danroth27/followers","following_url":"https://api.github.com/users/danroth27/following{/other_user}","gists_url":"https://api.github.com/users/danroth27/gists{/gist_id}","starred_url":"https://api.github.com/users/danroth27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danroth27/subscriptions","organizations_url":"https://api.github.com/users/danroth27/orgs","repos_url":"https://api.github.com/users/danroth27/repos","events_url":"https://api.github.com/users/danroth27/events{/privacy}","received_events_url":"https://api.github.com/users/danroth27/received_events","type":"User","site_admin":false},"open_issues":51,"closed_issues":5,"state":"open","created_at":"2018-01-25T17:03:38Z","updated_at":"2018-03-27T05:14:54Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2018-03-26T20:56:16Z","updated_at":"2018-03-27T08:06:32Z","closed_at":null,"author_association":"NONE","body":"It seems like SimpleJson cannot deserialize to a struct. e.g.\r\n```\r\n    public struct CommandResult\r\n    {\r\n        public String Message { get; set; }\r\n        public bool ContainsError { get; set; }\r\n        public int? ErrorId { get; set; }\r\n    }\r\n```\r\nIf you run this test\r\n```\r\n\t    [Test]\r\n\t    public void ThisIsFaling()\r\n\t    {\r\n\t        var json = SimpleJson.SimpleJson.SerializeObject(new CommandResult\r\n\t        {\r\n\t            Message = \"Hello World\",\r\n                ErrorId = 1\r\n\t        });\r\n\r\n\t        var data = SimpleJson.SimpleJson.DeserializeObject<CommandResult>(json);\r\n\t    }\r\n```\r\nwhich throws following exception\r\n```\r\nSystem.NullReferenceException : Object reference not set to an instance of an object.\r\n   at SimpleJson.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in D:\\********************\\SimpleJson.cs:line 1431\r\n   at SimpleJson.SimpleJson.DeserializeObject(String json, Type type, IJsonSerializerStrategy jsonSerializerStrategy) in D:\\******************\\SimpleJson.cs:line 578\r\n   at SimpleJson.SimpleJson.DeserializeObject[T](String json) in D:\\*****************\\SimpleJson.cs:line 595\r\n   at Pancake.Tests.EntityFrameworkTests.ThisIsFaling() in D:\\****************************Tests.cs:line 25\r\n```\r\n\r\nIf you change `CommandResult` to a `class` from a `struct` then it works fine.\r\n\r\nFYI: I copied the SimpleJson from your dev branch i.e. https://raw.githubusercontent.com/aspnet/Blazor/dev/src/Microsoft.AspNetCore.Blazor/Json/SimpleJson/SimpleJson.cs\r\n\r\n\r\nThis problem can be fixed if we change line no. 1431 \r\nfrom `obj = ConstructorCache[type]();` \r\nto `obj = ConstructorCache[type]?.Invoke() ?? Activator.CreateInstance(type);`\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/Blazor/issues/comments/376434431","html_url":"https://github.com/aspnet/Blazor/issues/388#issuecomment-376434431","issue_url":"https://api.github.com/repos/aspnet/Blazor/issues/388","id":376434431,"user":{"login":"conficient","id":454494,"avatar_url":"https://avatars3.githubusercontent.com/u/454494?v=4","gravatar_id":"","url":"https://api.github.com/users/conficient","html_url":"https://github.com/conficient","followers_url":"https://api.github.com/users/conficient/followers","following_url":"https://api.github.com/users/conficient/following{/other_user}","gists_url":"https://api.github.com/users/conficient/gists{/gist_id}","starred_url":"https://api.github.com/users/conficient/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conficient/subscriptions","organizations_url":"https://api.github.com/users/conficient/orgs","repos_url":"https://api.github.com/users/conficient/repos","events_url":"https://api.github.com/users/conficient/events{/privacy}","received_events_url":"https://api.github.com/users/conficient/received_events","type":"User","site_admin":false},"created_at":"2018-03-27T08:06:32Z","updated_at":"2018-03-27T08:06:32Z","author_association":"NONE","body":"A known issue in simple-json: https://github.com/facebook-csharp-sdk/simple-json/issues/39\r\n"}}
{"actor":{"display_login":"conficient"}}