{"action":"created","issue":{"url":"https://api.github.com/repos/akavache/Akavache/issues/312","repository_url":"https://api.github.com/repos/akavache/Akavache","labels_url":"https://api.github.com/repos/akavache/Akavache/issues/312/labels{/name}","comments_url":"https://api.github.com/repos/akavache/Akavache/issues/312/comments","events_url":"https://api.github.com/repos/akavache/Akavache/issues/312/events","html_url":"https://github.com/akavache/Akavache/issues/312","id":176470839,"number":312,"title":"Newtonsoft.Json.JsonSerializationException while attempting to fetch records","user":{"login":"codebeaulieu","id":9411281,"avatar_url":"https://avatars.githubusercontent.com/u/9411281?v=3","gravatar_id":"","url":"https://api.github.com/users/codebeaulieu","html_url":"https://github.com/codebeaulieu","followers_url":"https://api.github.com/users/codebeaulieu/followers","following_url":"https://api.github.com/users/codebeaulieu/following{/other_user}","gists_url":"https://api.github.com/users/codebeaulieu/gists{/gist_id}","starred_url":"https://api.github.com/users/codebeaulieu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codebeaulieu/subscriptions","organizations_url":"https://api.github.com/users/codebeaulieu/orgs","repos_url":"https://api.github.com/users/codebeaulieu/repos","events_url":"https://api.github.com/users/codebeaulieu/events{/privacy}","received_events_url":"https://api.github.com/users/codebeaulieu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-12T20:05:51Z","updated_at":"2016-09-13T20:12:29Z","closed_at":null,"body":"I'm working on my second Xamarin / ReactiveUI application that uses Akavache. Everything works perfectly fine in my first app yet my new app is returning a JsonSerializationException while attempting to fetch my object from the data store. I have gone over both of my apps several times and have made sure everything is indeed the same.\r\n\r\nI've spent two days trying to figure out what I've done wrong here to no avail... Along the way I ran into [open issue #95](https://github.com/akavache/Akavache/issues/95) where Paul states: \r\n\r\n> \"if you can track down a case where we're failing serialization/deserialization and ending up returning 'null', that'd definitely be a bug\"\r\n\r\nI don't know whether this _is_ an Akavache bug or my own fault, but I _do_ know that I'm completely out of ideas with this exception.\r\n\r\nMy Class:\r\n\r\n```\r\n[JsonObject]\r\npublic class Equity\r\n{ \r\n    public string Symbol { get; set; } \r\n    public DateTime InsertedOn { get; set; } \r\n    public decimal Entry { get; set; } \r\n    public decimal Exit { get; set; } \r\n    public int Quantity { get; set; }\r\n\r\n    [JsonIgnore]\r\n    public decimal Difference\r\n    {\r\n        get\r\n        { \r\n            return (Exit - Entry) * Quantity;\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nStorage / Fetch Procedure:\r\n\r\n```\r\ntry\r\n{\r\n    var equities = await BlobCache.LocalMachine.GetObject<ReactiveUI.ReactiveList<Equity>>(Global.AkavacheKeys.equityData);\r\n}\r\ncatch (KeyNotFoundException)\r\n{ \r\n    await BlobCache.LocalMachine.InsertObject<ReactiveList<Equity>>(Global.AkavacheKeys.equityData, equities);\r\n}\r\ncatch (Exception x)\r\n{\r\n    Debug.WriteLine(\"{0}\", x); // hits\r\n}\r\n```\r\n\r\nStack Trace:\r\n\r\n```\r\nException: Newtonsoft.Json.JsonSerializationException: Unexpected token while deserializing object: PropertyName. Path 'Value[0].Symbol'.\r\n  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x0013c] in <2781d1b198634655944cdefb18b3309b>:0 \r\n  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x0007a] in <2781d1b198634655944cdefb18b3309b>:0 \r\n--- End of stack trace from previous location where exception was thrown ---\r\n  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3426/d1ee3ba2/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 \r\n  at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow (System.Exception exception) [0x00006] in <50e73325239843abb1c421bf5dddc7a9>:0 \r\n  at System.Reactive.ExceptionHelpers.ThrowIfNotNull (System.Exception exception) [0x0000d] in <ab76b1b1678341d69f8fc2c1f68d0bf5>:0 \r\n  at System.Reactive.Subjects.AsyncSubject`1[T].GetResult () [0x00039] in <d0067ed104ac455987b6feb85f80156b>:0 \r\n  at xxx.DashboardViewModel+<RegisterObservables>c__async2.MoveNext () [0x00091] in xxx/ViewModels/DashboardViewModel.cs:103 \r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/akavache/Akavache/issues/comments/246808537","html_url":"https://github.com/akavache/Akavache/issues/312#issuecomment-246808537","issue_url":"https://api.github.com/repos/akavache/Akavache/issues/312","id":246808537,"user":{"login":"SimonSimCity","id":392589,"avatar_url":"https://avatars.githubusercontent.com/u/392589?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonSimCity","html_url":"https://github.com/SimonSimCity","followers_url":"https://api.github.com/users/SimonSimCity/followers","following_url":"https://api.github.com/users/SimonSimCity/following{/other_user}","gists_url":"https://api.github.com/users/SimonSimCity/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSimCity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSimCity/subscriptions","organizations_url":"https://api.github.com/users/SimonSimCity/orgs","repos_url":"https://api.github.com/users/SimonSimCity/repos","events_url":"https://api.github.com/users/SimonSimCity/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSimCity/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T20:12:28Z","updated_at":"2016-09-13T20:12:28Z","body":"Try to read the raw value by calling `await BlobCache.LocalMachine.Get(Global.AkavacheKeys.equityData)` or wrap it (like I did) into `BitConverter.ToString()` and analyze it in another editor of your choice, that can show invisible characters.\r\n\r\nCompare the outcome to what you would expect. Maybe there is something you see ...\r\n\r\nBut I guess the reason for the exception here is different from the one, I had on stackoverflow."}}
{"actor":{"display_login":"SimonSimCity"}}