-Added Serializable attribute to exceptions

-Fixed deserializing null values into DataTables
-Fixed error when deserializing readonly IEnumerable<T> array properties
-Fixed not including type name for byte[] values
This commit is contained in:
JamesNK
2011-05-07 02:16:26 +00:00
parent 1197d35cbb
commit 6b2238c39c
14 changed files with 185 additions and 7 deletions
@@ -399,6 +399,20 @@ namespace Newtonsoft.Json.Serialization
return PopulateObject(existingValue, reader, objectContract, id);
}
JsonPrimitiveContract primitiveContract = contract as JsonPrimitiveContract;
if (primitiveContract != null)
{
// if the content is inside $value then read past it
if (reader.TokenType == JsonToken.PropertyName && string.Equals(reader.Value.ToString(), JsonTypeReflector.ValuePropertyName, StringComparison.Ordinal))
{
CheckedRead(reader);
object value = CreateValueInternal(reader, objectType, primitiveContract, member, existingValue);
CheckedRead(reader);
return value;
}
}
#if !SILVERLIGHT && !PocketPC
JsonISerializableContract serializableContract = contract as JsonISerializableContract;
if (serializableContract != null)
@@ -688,6 +702,13 @@ namespace Newtonsoft.Json.Serialization
{
object list = wrappedList.UnderlyingCollection;
// can't populate an existing array
if (wrappedList.IsFixedSize)
{
reader.Skip();
return wrappedList.UnderlyingCollection;
}
if (reference != null)
Serializer.ReferenceResolver.AddReference(this, reference, list);