When putting an instance of an object into the Akavache-storage, all works out. But when trying to get it from the storage, I get the following error message:
Newtonsoft.Json.JsonSerializationException: Unexpected token while deserializing object: EndObject. Path 'Value.Tracks[0]'.
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) [0x0015f] in <filename unknown>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, Boolean checkAdditionalContent) [0x0007e] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/1503/c2c00129/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow (System.Exception exception) [0x00006] in <filename unknown>:0
at System.Reactive.ExceptionHelpers.ThrowIfNotNull (System.Exception exception) [0x0000d] in <filename unknown>:0
at System.Reactive.Subjects.AsyncSubject`1[System.Collections.Generic.IEnumerable`1[Core.OfflineTrackCollection]].GetResult () [0x00039] in <filename unknown>:0
at Core.OfflineTrackCollectionClient+<GetAll>c__async0.MoveNext () [0x00080] in /--Path--/Core/OfflineTrackCollectionClient.cs:30
I previously deserialized that object after fetching the JSON from a remote service using the following deserializers:
// Try to parse the response into the requested object
var settings = new JsonSerializerSettings { ContractResolver = new UnderscoreMappingResolver() };
var obj = JsonConvert.DeserializeObject<T>(jsonString, settings);
Within the class T
I make use of some custom JsonConverter
and also set a property-name by using JsonProperty
- all done by annotation. DateTime objects are also along here (if that has something to say ..)
I can't wrap my head around, what I am doing wrong here - and I haven't found anything online. Later you can see the object OfflineTrackCollection
I try to get here. What I've tried is, that it works if I remove that Track
list or if I leave it empty. So it has something to do with a track-object (you can find the object below). Do you have any idea, or have you had that problem earlier?
Here is the class and some objects. Ping me if you want to see more code. The converters aren't called (at least the debugger didn't stop there).
namespace Core
{
public class OfflineTrackCollectionClient : IOfflineTrackCollectionClient
{
const string STORAGE_PREFIX = "track_collection_";
public async Task<IList<OfflineTrackCollection>> GetAll()
{
try {
var objects = await BlobCache.LocalMachine.GetAllObjects<OfflineTrackCollection>();
return objects.ToList();
} catch (Exception e)
{
throw;
}
}
public async Task Save(TrackCollection item)
{
var offlineTrackCollection = new OfflineTrackCollection() { Id = item.Id, Name = item.Name };
foreach(var track in item.Tracks)
offlineTrackCollection.Tracks.Add(track);
await BlobCache.LocalMachine.InsertObject<OfflineTrackCollection>(STORAGE_PREFIX + offlineTrackCollection.Id, offlineTrackCollection);
}
}
[JsonObject]
public class OfflineTrackCollection
{
public int Id { get; set; }
public string Name { get; set; }
public IList<Track> Tracks { get; set; }
}
[JsonObject]
public class Track : Document
{
public Track()
{
Type = DocumentType.TRACK;
}
public int ParentId { get; set; }
public bool IsVisible { get; set; }
[JsonConverter(typeof (StringEnumConverter))]
public TrackSubType Subtype { get; set; }
public IEnumerable<string> Tags { get; set; }
public DateTime RecordedAt { get; set; }
[JsonProperty(PropertyName = "_meta")]
public TrackMetadata Meta { get; set; }
public IEnumerable<TrackMedia> Media { get; set; }
}
[JsonObject]
[JsonConverter(typeof (DocumentConverter))]
public class Document
{
public int Id { get; set; }
[JsonConverter(typeof (StringEnumConverter))]
public DocumentType Type { get; set; }
public bool ShouldSerializeId()
{
return false;
}
}
}
namespace Core.JsonConverter
{
public class DocumentConverter : JsonCreationConverter<Document>
{
protected override Document Create(Type objectType, JObject jObject)
{
// First check up if the objectType is already fixed to a implementation.
if (objectType == typeof (Track))
return new Track();
// A type has to be defined for type-juggling.
if (jObject["type"] == null)
{
throw new NotImplementedException("The type of the document has not been defined!");
}
// Try to find out what the implementation is.
switch (jObject["type"].Value<string>())
{
case "track":
return new Track();
}
throw new NotImplementedException("The type " + jObject["type"].Value<string>() +
" is not implemented in the DocumentConverter.");
}
}
// Copied from http://stackoverflow.com/questions/8030538/how-to-implement-custom-jsonconverter-in-json-net-to-deserialize-a-list-of-base
public abstract class JsonCreationConverter<T> : Newtonsoft.Json.JsonConverter
{
public override bool CanRead
{
get { return true; }
}
public override bool CanWrite
{
get { return false; }
}
/// <summary>
/// Create an instance of objectType, based properties in the JSON object
/// </summary>
/// <param name="objectType">type of object expected</param>
/// <param name="jObject">
/// contents of JSON object that will be deserialized
/// </param>
/// <returns></returns>
protected abstract T Create(Type objectType, JObject jObject);
public override bool CanConvert(Type objectType)
{
return typeof (T).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
}
public override object ReadJson(JsonReader reader,
Type objectType,
object existingValue,
JsonSerializer serializer)
{
// Load JObject from stream
var jObject = JObject.Load(reader);
// Create target object based on JObject
var target = Create(objectType, jObject);
// Populate the object properties
serializer.Populate(jObject.CreateReader(), target);
return target;
}
public override void WriteJson(JsonWriter writer,
object value,
JsonSerializer serializer)
{
// Should never be called, as the property CanWrite is set to FALSE
throw new NotImplementedException();
}
}
}
EDIT Added the JsonConverter and the data I get out of when calling BitConverter.ToString(await BlobCache.LocalMachine.Get("track_collection_1"))
:
CA-11-00-00-03-56-61-6C-75-65-00-BE-11-00-00-10-49-64-00-34-2D-00-00-02-4E-61-6D-65-00-05-00-00-00-42-72-65-77-00-04-54-72-61-63-6B-73-00-9A-11-00-00-03-30-00-DF-09-00-00-10-50-61-72-65-6E-74-49-64-00-5F-AA-00-00-08-49-73-56-69-73-69-62-6C-65-00-01-10-4F-72-64-65-72-00-02-00-00-00-02-53-75-62-74-79-70-65-00-07-00-00-00-73-70-65-65-63-68-00-04-54-61-67-73-00-05-00-00-00-00-09-52-65-63-6F-72-64-65-64-41-74-00-00-F0-70-AA-11-01-00-00-09-50-75-62-6C-69-73-68-65-64-41-74-00-00-F0-70-AA-11-01-00-00-04-72-65-6C-00-AE-02-00-00-03-30-00-38-00-00-00-10-49-64-00-A2-8E-00-00-02-4E-61-6D-65-00-0D-00-00-00-4a-6f-68-6e-20-44-6f-65-0d-0a-00-02-54-79-70-65-00-0A-00-00-00-69-6E-74-65-72-70-72-65-74-00-00-03-31-00-4C-00-00-00-10-54-69-6D-65-73-74-61-6D-70-00-00-00-00-00-02-42-6F-6F-6B-00-06-00-00-00-31-20-70-65-74-00-10-43-68-61-70-74-65-72-00-01-00-00-00-10-56-65-72-73-65-00-11-00-00-00-02-54-79-70-65-00-06-00-00-00-62-69-62-6C-65-00-00-03-32-00-4C-00-00-00-10-54-69-6D-65-73-74-61-6D-70-00-00-00-00-00-02-42-6F-6F-6B-00-06-00-00-00-31-20-70-65-74-00-10-43-68-61-70-74-65-72-00-01-00-00-00-10-56-65-72-73-65-00-12-00-00-00-02-54-79-70-65-00-06-00-00-00-62-69-62-6C-65-00-00-03-33-00-4C-00-00-00-10-54-69-6D-65-73-74-61-6D-70-00-00-00-00-00-02-42-6F-6F-6B-00-06-00-00-00-31-20-70-65-74-00-10-43-68-61-70-74-65-72-00-01-00-00-00-10-56-65-72-73-65-00-13-00-00-00-02-54-79-70-65-00-06-00-00-00-62-69-62-6C-65-00-00-03-34-00-4A-00-00-00-10-54-69-6D-65-73-74-61-6D-70-00-00-00-00-00-02-42-6F-6F-6B-00-04-00-00-00-72-65-76-00-10-43-68-61-70-74-65-72-00-0E-00-00-00-10-56-65-72-73-65-00-03-00-00-00-02-54-79-70-65-00-06-00-00-00-62-69-62-6C-65-00-00-03-35-00-4A-00-00-00-10-54-69-6D-65-73-74-61-6D-70-00-00-00-00-00-02-42-6F-6F-6B-00-04-00-00-00-72-65-76-00-10-43-68-61-70-74-65-72-00-0E-00-00-00-10-56-65-72-73-65-00-04-00-00-00-02-54-79-70-65-00-06-00-00-00-62-69-62-6C-65-00-00-03-36-00-4A-00-00-00-10-54-69-6D-65-73-74-61-6D-70-00-00-00-00-00-02-42-6F-6F-6B-00-04-00-00-00-72-65-76-00-10-43-68-61-70-74-65-72-00-0E-00-00-00-10-56-65-72-73-65-00-05-00-00-00-02-54-79-70-65-00-06-00-00-00-62-69-62-6C-65-00-00-03-37-00-4A-00-00-00-10-54-69-6D-65-73-74-61-6D-70-00-00-00-00-00-02-42-6F-6F-6B-00-04-00-00-00-72-65-76-00-10-43-68-61-70-74-65-72-00-04-00-00-00-10-56-65-72-73-65-00-0A-00-00-00-02-54-79-70-65-00-06-00-00-00-62-69-62-6C-65-00-00-03-38-00-4A-00-00-00-10-54-69-6D-65-73-74-61-6D-70-00-00-00-00-00-02-42-6F-6F-6B-00-04-00-00-00-72-65-76-00-10-43-68-61-70-74-65-72-00-04-00-00-00-10-56-65-72-73-65-00-0B-00-00-00-02-54-79-70-65-00-06-00-00-00-62-69-62-6C-65-00-00-00-03-5F-6D-65-74-61-00-92-05-00-00-10-52-6F-6F-74-50-61-72-65-6E-74-49-64-00-D9-5F-01-00-08-49-73-56-69-73-69-62-6C-65-00-01-09-4D-6F-64-69-66-69-65-64-41-74-00-28-1F-04-69-45-01-00-00-02-4D-6F-64-69-66-69-65-64-42-79-00-0D-00-00-00-73-69-6D-6F-6E-73-69-6D-63-69-74-79-00-02-54-69-74-6C-65-00-0D-00-00-00-4a-6f-68-6e-20-44-6f-65-0d-0a-00-02-4C-61-6E-67-75-61-67-65-00-04-00-00-00-6E-6F-62-00-02-41-6C-62-75-6D-00-2C-00-00-00-50-C3-A5-73-6B-65-73-74-65-76-6E-65-20-32-30-30-37-2C-20-4D-C3-B8-74-65-20-66-72-65-2E-20-36-2E-20-61-70-72-2E-20-32-30-3A-30-30-00-10-54-72-61-63-6B-6E-75-6D-62-65-72-00-02-00-00-00-02-41-72-74-69-73-74-00-0D-00-00-00-4a-6f-68-6e-20-44-6f-65-0d-0a-00-02-4C-79-72-69-63-69-73-74-00-01-00-00-00-00-02-43-6F-6D-70-6F-73-65-72-00-01-00-00-00-00-02-50-75-62-6C-69-73-68-65-72-00-1A-00-00-00-50-75-62-6c-69-73-68-65-72-00-10-49-74-75-6E-65-73-63-6F-6D-70-69-6C-61-74-69-6F-6E-00-01-00-00-00-02-41-74-74-61-63-68-65-64-50-69-63-74-75-72-65-00-67-00-00-00-68-74-74-70-73-3A-2F-2F-73-61-6d-70-6c-65-2e-6f-72-67-2F-66-69-6C-65-2F-70-72-6F-74-65-63-74-65-64-2F-61-6C-62-75-6D-2F-39-30-30-37-33-2F-61-6C-62-75-6D-5F-39-30-30-37-33-5F-63-6F-76-65-72-2E-6A-70-65-67-3F-6C-61-73-74-2D-63-68-61-6E-67-65-64-3D-31-33-39-36-38-39-31-35-38-34-00-02-54-69-6D-65-00-05-00-00-00-30-30-30-30-00-02-44-61-74-65-00-05-00-00-00-30-31-30-34-00-02-59-65-61-72-00-05-00-00-00-32-30-30-37-00-02-43-6F-70-79-72-69-67-68-74-00-23-00-00-00-43-6f-70-79-72-69-67-68-74-00-03-50-61-72-65-6E-74-00-84-01-00-00-10-50-61-72-65-6E-74-49-64-00-D9-5F-01-00-02-42-6D-6D-49-64-00-08-00-00-00-30-37-30-34-4D-30-32-00-04-54-61-67-73-00-14-00-00-00-02-30-00-08-00-00-00-4D-65-65-74-69-6E-67-00-00-09-50-75-62-6C-69-73-68-65-64-41-74-00-F8-AB-0D-C8-11-01-00-00-03-5F-6D-65-74-61-00-81-00-00-00-08-49-73-56-69-73-69-62-6C-65-00-01-09-4D-6F-64-69-66-69-65-64-41-74-00-80-CA-ED-3B-49-01-00-00-02-4D-6F-64-69-66-69-65-64-42-79-00-09-00-00-00-64-61-6E-6E-69-2E-73-2E-00-04-43-6F-6E-74-61-69-6E-65-64-54-79-70-65-73-00-33-00-00-00-02-30-00-09-00-00-00-65-78-65-67-65-73-69-73-00-02-31-00-09-00-00-00-73-69-6E-67-73-6F-6E-67-00-02-32-00-07-00-00-00-73-70-65-65-63-68-00-00-00-0A-43-6F-76-65-72-00-04-4C-61-6E-67-75-61-67-65-73-00-41-00-00-00-02-30-00-03-00-00-00-64-65-00-02-31-00-03-00-00-00-65-6E-00-02-32-00-03-00-00-00-65-73-00-02-33-00-03-00-00-00-66-72-00-02-34-00-03-00-00-00-6E-62-00-02-35-00-03-00-00-00-6E-6C-00-00-02-4C-61-6E-67-75-61-67-65-00-03-00-00-00-6E-62-00-02-54-69-74-6C-65-00-19-00-00-00-4D-C3-B8-74-65-20-66-72-65-2E-20-36-2E-20-61-70-72-2E-20-32-30-3A-30-30-00-04-43-68-69-6C-64-72-65-6E-00-05-00-00-00-00-02-54-79-70-65-00-06-00-00-00-61-6C-62-75-6D-00-00-03-52-6F-6F-74-50-61-72-65-6E-74-00-E2-01-00-00-0A-50-61-72-65-6E-74-49-64-00-0A-42-6D-6D-49-64-00-04-54-61-67-73-00-1E-00-00-00-02-30-00-12-00-00-00-45-61-73-74-65-72-20-43-6F-6E-66-65-72-65-6E-63-65-00-00-09-50-75-62-6C-69-73-68-65-64-41-74-00-00-F0-70-AA-11-01-00-00-03-5F-6D-65-74-61-00-81-00-00-00-08-49-73-56-69-73-69-62-6C-65-00-01-09-4D-6F-64-69-66-69-65-64-41-74-00-18-DB-F4-3B-49-01-00-00-02-4D-6F-64-69-66-69-65-64-42-79-00-09-00-00-00-64-61-6E-6E-69-2E-73-2E-00-04-43-6F-6E-74-61-69-6E-65-64-54-79-70-65-73-00-33-00-00-00-02-30-00-09-00-00-00-65-78-65-67-65-73-69-73-00-02-31-00-09-00-00-00-73-69-6E-67-73-6F-6E-67-00-02-32-00-07-00-00-00-73-70-65-65-63-68-00-00-00-02-43-6F-76-65-72-00-67-00-00-00-68-74-74-70-73-3A-2F-2F-73-61-6d-70-6c-65-2e-6f-72-67-2F-66-69-6C-65-2F-70-72-6F-74-65-63-74-65-64-2F-61-6C-62-75-6D-2F-39-30-30-37-33-2F-61-6C-62-75-6D-5F-39-30-30-37-33-5F-63-6F-76-65-72-2E-6A-70-65-67-3F-6C-61-73-74-2D-63-68-61-6E-67-65-64-3D-31-33-39-36-38-39-31-35-38-34-00-04-4C-61-6E-67-75-61-67-65-73-00-41-00-00-00-02-30-00-03-00-00-00-64-65-00-02-31-00-03-00-00-00-65-6E-00-02-32-00-03-00-00-00-65-73-00-02-33-00-03-00-00-00-66-72-00-02-34-00-03-00-00-00-6E-62-00-02-35-00-03-00-00-00-6E-6C-00-00-02-4C-61-6E-67-75-61-67-65-00-03-00-00-00-6E-62-00-02-54-69-74-6C-65-00-12-00-00-00-50-C3-A5-73-6B-65-73-74-65-76-6E-65-20-32-30-30-37-00-04-43-68-69-6C-64-72-65-6E-00-05-00-00-00-00-02-54-79-70-65-00-06-00-00-00-61-6C-62-75-6D-00-00-00-0A-43-6F-76-65-72-55-72-6C-00-0A-41-76-61-69-6C-61-62-6C-65-4C-61-6E-67-75-61-67-65-73-00-02-4C-61-6E-67-75-61-67-65-00-03-00-00-00-6E-62-00-0A-54-69-74-6C-65-00-04-4D-65-64-69-61-00-D4-00-00-00-03-30-00-CC-00-00-00-02-54-79-70-65-00-06-00-00-00-61-75-64-69-6F-00-04-46-69-6C-65-73-00-B0-00-00-00-03-30-00-A8-00-00-00-02-4D-69-6D-65-54-79-70-65-00-0B-00-00-00-61-75-64-69-6F-2F-6D-70-65-67-00-10-53-69-7A-65-00-62-4D-ED-00-10-44-75-72-61-74-69-6F-6E-00-CB-03-00-00-02-55-72-6C-00-69-00-00-00-68-74-74-70-73-3A-2F-2F-73-61-6d-70-6c-65-2e-6f-72-67-2F-66-69-6C-65-2F-70-72-6F-74-65-63-74-65-64-2F-74-72-61-63-6B-2F-34-33-36-31-38-2F-74-72-61-63-6B-5F-34-33-36-31-38-5F-6D-65-64-69-61-5F-6E-62-2E-6D-70-33-3F-6C-61-73-74-2D-63-68-61-6E-67-65-64-3D-31-34-31-34-30-35-30-31-35-31-00-00-00-00-00-02-54-79-70-65-00-06-00-00-00-74-72-61-63-6B-00-00-03-31-00-B0-07-00-00-10-50-61-72-65-6E-74-49-64-00-9C-AA-00-00-08-49-73-56-69-73-69-62-6C-65-00-01-10-4F-72-64-65-72-00-10-00-00-00-02-53-75-62-74-79-70-65-00-07-00-00-00-73-70-65-65-63-68-00-04-54-61-67-73-00-05-00-00-00-00-09-52-65-63-6F-72-64-65-64-41-74-00-00-F0-70-AA-11-01-00-00-09-50-75-62-6C-69-73-68-65-64-41-74-00-00-F0-70-AA-11-01-00-00-04-72-65-6C-00-8D-00-00-00-03-30-00-38-00-00-00-10-49-64-00-AD-8E-00-00-02-4E-61-6D-65-00-0D-00-00-00-4a-6f-68-6e-20-44-6f-65-00-02-54-79-70-65-00-0A-00-00-00-69-6E-74-65-72-70-72-65-74-00-00-03-31-00-4A-00-00-00-10-54-69-6D-65-73-74-61-6D-70-00-00-00-00-00-02-42-6F-6F-6B-00-04-00-00-00-6D-69-63-00-10-43-68-61-70-74-65-72-00-07-00-00-00-10-56-65-72-73-65-00-04-00-00-00-02-54-79-70-65-00-06-00-00-00-62-69-62-6C-65-00-00-00-03-5F-6D-65-74-61-00-84-05-00-00-10-52-6F-6F-74-50-61-72-65-6E-74-49-64-00-D9-5F-01-00-08-49-73-56-69-73-69-62-6C-65-00-01-09-4D-6F-64-69-66-69-65-64-41-74-00-78-2F-0D-69-45-01-00-00-02-4D-6F-64-69-66-69-65-64-42-79-00-0D-00-00-00-73-69-6D-6F-6E-73-69-6D-63-69-74-79-00-02-54-69-74-6C-65-00-0D-00-00-00-4a-6f-68-6e-20-44-6f-65-00-02-4C-61-6E-67-75-61-67-65-00-04-00-00-00-6E-6F-62-00-02-41-6C-62-75-6D-00-2D-00-00-00-50-C3-A5-73-6B-65-73-74-65-76-6E-65-20-32-30-30-37-2C-20-4D-C3-B8-74-65-20-73-C3-B8-6E-2E-20-38-2E-20-61-70-72-2E-20-31-31-3A-30-30-00-10-54-72-61-63-6B-6E-75-6D-62-65-72-00-10-00-00-00-02-41-72-74-69-73-74-00-0D-00-00-00-4a-6f-68-6e-20-44-6f-65-00-02-4C-79-72-69-63-69-73-74-00-01-00-00-00-00-02-43-6F-6D-70-6F-73-65-72-00-01-00-00-00-00-02-50-75-62-6C-69-73-68-65-72-00-1A-00-00-00-50-75-62-6c-69-73-68-65-72-00-10-49-74-75-6E-65-73-63-6F-6D-70-69-6C-61-74-69-6F-6E-00-01-00-00-00-02-41-74-74-61-63-68-65-64-50-69-63-74-75-72-65-00-67-00-00-00-68-74-74-70-73-3A-2F-2F-73-61-6d-70-6c-65-2e-6f-72-67-2F-66-69-6C-65-2F-70-72-6F-74-65-63-74-65-64-2F-61-6C-62-75-6D-2F-39-30-30-37-33-2F-61-6C-62-75-6D-5F-39-30-30-37-33-5F-63-6F-76-65-72-2E-6A-70-65-67-3F-6C-61-73-74-2D-63-68-61-6E-67-65-64-3D-31-33-39-36-38-39-31-35-38-34-00-02-54-69-6D-65-00-05-00-00-00-30-30-30-30-00-02-44-61-74-65-00-05-00-00-00-30-31-30-34-00-02-59-65-61-72-00-05-00-00-00-32-30-30-37-00-02-43-6F-70-79-72-69-67-68-74-00-23-00-00-00-43-6f-70-79-72-69-67-68-74-00-03-50-61-72-65-6E-74-00-75-01-00-00-10-50-61-72-65-6E-74-49-64-00-D9-5F-01-00-02-42-6D-6D-49-64-00-08-00-00-00-30-37-30-34-4D-30-35-00-04-54-61-67-73-00-14-00-00-00-02-30-00-08-00-00-00-4D-65-65-74-69-6E-67-00-00-09-50-75-62-6C-69-73-68-65-64-41-74-00-50-DE-6B-D0-11-01-00-00-03-5F-6D-65-74-61-00-71-00-00-00-08-49-73-56-69-73-69-62-6C-65-00-01-09-4D-6F-64-69-66-69-65-64-41-74-00-58-8F-F1-3B-49-01-00-00-02-4D-6F-64-69-66-69-65-64-42-79-00-09-00-00-00-64-61-6E-6E-69-2E-73-2E-00-04-43-6F-6E-74-61-69-6E-65-64-54-79-70-65-73-00-23-00-00-00-02-30-00-09-00-00-00-73-69-6E-67-73-6F-6E-67-00-02-31-00-07-00-00-00-73-70-65-65-63-68-00-00-00-0A-43-6F-76-65-72-00-04-4C-61-6E-67-75-61-67-65-73-00-41-00-00-00-02-30-00-03-00-00-00-64-65-00-02-31-00-03-00-00-00-65-6E-00-02-32-00-03-00-00-00-65-73-00-02-33-00-03-00-00-00-66-72-00-02-34-00-03-00-00-00-6E-62-00-02-35-00-03-00-00-00-6E-6C-00-00-02-4C-61-6E-67-75-61-67-65-00-03-00-00-00-6E-62-00-02-54-69-74-6C-65-00-1A-00-00-00-4D-C3-B8-74-65-20-73-C3-B8-6E-2E-20-38-2E-20-61-70-72-2E-20-31-31-3A-30-30-00-04-43-68-69-6C-64-72-65-6E-00-05-00-00-00-00-02-54-79-70-65-00-06-00-00-00-61-6C-62-75-6D-00-00-03-52-6F-6F-74-50-61-72-65-6E-74-00-E2-01-00-00-0A-50-61-72-65-6E-74-49-64-00-0A-42-6D-6D-49-64-00-04-54-61-67-73-00-1E-00-00-00-02-30-00-12-00-00-00-45-61-73-74-65-72-20-43-6F-6E-66-65-72-65-6E-63-65-00-00-09-50-75-62-6C-69-73-68-65-64-41-74-00-00-F0-70-AA-11-01-00-00-03-5F-6D-65-74-61-00-81-00-00-00-08-49-73-56-69-73-69-62-6C-65-00-01-09-4D-6F-64-69-66-69-65-64-41-74-00-18-DB-F4-3B-49-01-00-00-02-4D-6F-64-69-66-69-65-64-42-79-00-09-00-00-00-64-61-6E-6E-69-2E-73-2E-00-04-43-6F-6E-74-61-69-6E-65-64-54-79-70-65-73-00-33-00-00-00-02-30-00-09-00-00-00-65-78-65-67-65-73-69-73-00-02-31-00-09-00-00-00-73-69-6E-67-73-6F-6E-67-00-02-32-00-07-00-00-00-73-70-65-65-63-68-00-00-00-02-43-6F-76-65-72-00-67-00-00-00-68-74-74-70-73-3A-2F-2F-73-61-6d-70-6c-65-2e-6f-72-67-2F-66-69-6C-65-2F-70-72-6F-74-65-63-74-65-64-2F-61-6C-62-75-6D-2F-39-30-30-37-33-2F-61-6C-62-75-6D-5F-39-30-30-37-33-5F-63-6F-76-65-72-2E-6A-70-65-67-3F-6C-61-73-74-2D-63-68-61-6E-67-65-64-3D-31-33-39-36-38-39-31-35-38-34-00-04-4C-61-6E-67-75-61-67-65-73-00-41-00-00-00-02-30-00-03-00-00-00-64-65-00-02-31-00-03-00-00-00-65-6E-00-02-32-00-03-00-00-00-65-73-00-02-33-00-03-00-00-00-66-72-00-02-34-00-03-00-00-00-6E-62-00-02-35-00-03-00-00-00-6E-6C-00-00-02-4C-61-6E-67-75-61-67-65-00-03-00-00-00-6E-62-00-02-54-69-74-6C-65-00-12-00-00-00-50-C3-A5-73-6B-65-73-74-65-76-6E-65-20-32-30-30-37-00-04-43-68-69-6C-64-72-65-6E-00-05-00-00-00-00-02-54-79-70-65-00-06-00-00-00-61-6C-62-75-6D-00-00-00-0A-43-6F-76-65-72-55-72-6C-00-0A-41-76-61-69-6C-61-62-6C-65-4C-61-6E-67-75-61-67-65-73-00-02-4C-61-6E-67-75-61-67-65-00-03-00-00-00-6E-62-00-0A-54-69-74-6C-65-00-04-4D-65-64-69-61-00-D4-00-00-00-03-30-00-CC-00-00-00-02-54-79-70-65-00-06-00-00-00-61-75-64-69-6F-00-04-46-69-6C-65-73-00-B0-00-00-00-03-30-00-A8-00-00-00-02-4D-69-6D-65-54-79-70-65-00-0B-00-00-00-61-75-64-69-6F-2F-6D-70-65-67-00-10-53-69-7A-65-00-2E-77-1E-00-10-44-75-72-61-74-69-6F-6E-00-7C-00-00-00-02-55-72-6C-00-69-00-00-00-68-74-74-70-73-3A-2F-2F-73-61-6d-70-6c-65-2e-6f-72-67-2F-66-69-6C-65-2F-70-72-6F-74-65-63-74-65-64-2F-74-72-61-63-6B-2F-34-33-36-39-33-2F-74-72-61-63-6B-5F-34-33-36-39-33-5F-6D-65-64-69-61-5F-6E-62-2E-6D-70-33-3F-6C-61-73-74-2D-63-68-61-6E-67-65-64-3D-31-34-31-34-30-35-30-31-38-30-00-00-00-00-00-02-54-79-70-65-00-06-00-00-00-74-72-61-63-6B-00-00-00-00-00
I don't really know the details of how Akavache does the serialization for storing an object in the SQL file ... but it either does not store that here or it does something to it before sending it into the JsonSerialization
While working on a minimal example, I recalled the mistakes I did:
Akavache didn't knew about the UnderscoreMappingResolver
by the time I called the serializer. Therefore, it serialized and saved the document as { Type: "track" }
but the DocumentConverter
expected the property Type
to be lowercase when de-serializing, like it was done when de-serializing the JSON string I got from the server.
I - back then - fixed it by implementing a switch in the DocumentConverter
to either take the property type
or Type
. This means in coe, that I replace jObject["type"]
by jObject["type"] ?? jObject["Type"]
.
Today, I'd rather overwrite the serializing-settings of Akavache: How can I set JsonSerializerSettings for Akavache?
@DanBeaulieu, I'd ask you to debug your implementation of JsonCreationConverter<T>
. Maybe an exception is thrown in your implementation or it quits without sending an instance of the object you'd expect.