我在反序列化期间收到此错误。
这是我对序列化程序的设置:
class CustomContractResolver : DefaultContractResolver
{
public new static readonly CustomContractResolver Instance = new CustomContractResolver();
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
JsonProperty property = base.CreateProperty(member, memberSerialization);
if (property.DeclaringType == typeof(Vector3))
{
property.Ignored = true;
}
return property;
}
protected override JsonContract CreateContract(Type objectType)
{
if (objectType.GetInterfaces().Any(i => i == typeof(IDictionary) ||
(i.IsGenericType &&
i.GetGenericTypeDefinition() == typeof(IDictionary<,>))))
{
return base.CreateArrayContract(objectType);
}
return base.CreateContract(objectType);
}
}
JsonSerializerjson = new JsonSerializer();
json.Formatting = Formatting.Indented;
json.ObjectCreationHandling = ObjectCreationHandling.Reuse;
json.NullValueHandling = NullValueHandling.Ignore;
json.StringEscapeHandling = StringEscapeHandling.Default;
json.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
json.TypeNameHandling = TypeNameHandling.Objects;
json.DefaultValueHandling = DefaultValueHandling.Ignore;
json.PreserveReferencesHandling = PreserveReferencesHandling.All;
json.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;
json.ContractResolver = new CustomContractResolver();
serializer = new global::AdamantiumSerializer.AdamantiumSerializer();
序列化进展顺利,但在反序列化期间我收到该错误。 我错过了什么吗?
平台:Windows 8.1、WinRT、
JSON 版本 6.0.6。
对不起,这是我的错。 问题已经解决了。
你是怎么解决这个问题的?
和上面一样问...