I'm running into an issue where Json.net won't deseralize this:
class MyKey : LikeType<string> { ... }
class MyVal : LikeType<int> { ... }
class MyCollection : LikeType<IReadOnlyDictionary<MyKey,MyVal>> { ... }
void ShowError(IJsonSerializer j, MyCollection val){
var data = j.Seralize(val);
var result = j.Deseralize(data, typeof(MyCollection)); //Blows up
}
I think the deserialize method is trying to send an IReadOnlyDictionay<string,MyVal> into the MyCollection constructor and throws this exception
Could not convert string 'value4eea4a6f-b2fa-428e-b245-9725e7f75798' to dictionary key type 'MyKey'. Create a TypeConverter to convert from the string to the key type object.
I suspect that if we have an explicit conversion then JSON.net may know how to make this work.
I'm running into an issue where Json.net won't deseralize this:
I think the deserialize method is trying to send an
IReadOnlyDictionay<string,MyVal>into the MyCollection constructor and throws this exceptionI suspect that if we have an explicit conversion then JSON.net may know how to make this work.