-Fixed build
This commit is contained in:
@@ -56,17 +56,17 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.AreEqual(JsonToken.StartArray, reader.TokenType);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(1.0d, reader.Value);
|
||||
Assert.AreEqual(1.0m, reader.Value);
|
||||
Assert.AreEqual(typeof(decimal), reader.ValueType);
|
||||
Assert.AreEqual(JsonToken.Float, reader.TokenType);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(1, reader.Value);
|
||||
Assert.AreEqual(1l, reader.Value);
|
||||
Assert.AreEqual(typeof(long), reader.ValueType);
|
||||
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(9.9d, reader.Value);
|
||||
Assert.AreEqual(9.9m, reader.Value);
|
||||
Assert.AreEqual(typeof(decimal), reader.ValueType);
|
||||
Assert.AreEqual(JsonToken.Float, reader.TokenType);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
FloatParseHandling = Json.FloatParseHandling.Decimal
|
||||
});
|
||||
|
||||
Assert.AreEqual(9.9d, v.Value);
|
||||
Assert.AreEqual(9.9m, v.Value);
|
||||
Assert.AreEqual(typeof(decimal), v.Value.GetType());
|
||||
}
|
||||
|
||||
|
||||
@@ -75,4 +75,4 @@ using System.Security;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("4.5.0.0")]
|
||||
[assembly: AssemblyFileVersion("5.0.1.15926")]
|
||||
[assembly: AssemblyFileVersion("5.0.1.15929")]
|
||||
|
||||
@@ -3922,7 +3922,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
});
|
||||
|
||||
Assert.AreEqual(typeof(decimal), dic["value"].GetType());
|
||||
Assert.AreEqual(9.9d, dic["value"]);
|
||||
Assert.AreEqual(9.9m, dic["value"]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -90,6 +90,6 @@ using System.Security;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("4.5.0.0")]
|
||||
[assembly: AssemblyFileVersion("5.0.1.15926")]
|
||||
[assembly: AssemblyFileVersion("5.0.1.15929")]
|
||||
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
@@ -129,35 +129,44 @@ namespace Newtonsoft.Json.Serialization
|
||||
canDeserialize = true;
|
||||
ShouldCreateWrapper = true;
|
||||
}
|
||||
else if (underlyingType.IsGenericType() && underlyingType.GetGenericTypeDefinition() == typeof(IEnumerable<>))
|
||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE)
|
||||
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof (IReadOnlyCollection<>), out tempCollectionType))
|
||||
{
|
||||
_genericCollectionDefinitionType = typeof(IEnumerable<>);
|
||||
CollectionItemType = underlyingType.GetGenericArguments()[0];
|
||||
|
||||
IsReadOnlyOrFixedSize = true;
|
||||
canDeserialize = true;
|
||||
TemporaryCollectionType = ReflectionUtils.MakeGenericType(typeof(List<>), CollectionItemType);
|
||||
ShouldCreateWrapper = !typeof(IList).IsAssignableFrom(underlyingType);
|
||||
|
||||
canDeserialize = (ResolveReadOnlyCollectionConstructor(underlyingType, CollectionItemType) != null
|
||||
|| underlyingType.GetGenericTypeDefinition() == typeof(IReadOnlyCollection<>)
|
||||
|| underlyingType.GetGenericTypeDefinition() == typeof(IReadOnlyList<>));
|
||||
}
|
||||
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof(IEnumerable<>), out tempCollectionType))
|
||||
#endif
|
||||
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof (IEnumerable<>), out tempCollectionType))
|
||||
{
|
||||
CollectionItemType = tempCollectionType.GetGenericArguments()[0];
|
||||
|
||||
IsReadOnlyOrFixedSize = true;
|
||||
canDeserialize = (ResolveReadOnlyCollectionConstructor(underlyingType, CollectionItemType) != null);
|
||||
TemporaryCollectionType = ReflectionUtils.MakeGenericType(typeof(List<>), CollectionItemType);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE)
|
||||
else if (underlyingType.IsGenericType() && underlyingType.GetGenericTypeDefinition() == typeof(IReadOnlyCollection<>))
|
||||
{
|
||||
CollectionItemType = underlyingType.GetGenericArguments()[0];
|
||||
IsReadOnlyOrFixedSizeCollection = true;
|
||||
if (underlyingType.GetGenericTypeDefinition() == typeof (IEnumerable<>))
|
||||
{
|
||||
_genericCollectionDefinitionType = tempCollectionType;
|
||||
|
||||
_readOnlyCollectionConstructor = ResolveReadOnlyCollectionConstructor(underlyingType, CollectionItemType);
|
||||
IsReadOnlyOrFixedSize = false;
|
||||
ShouldCreateWrapper = false;
|
||||
canDeserialize = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsReadOnlyOrFixedSize = true;
|
||||
ShouldCreateWrapper = true;
|
||||
canDeserialize = (ResolveReadOnlyCollectionConstructor(underlyingType, CollectionItemType) != null);
|
||||
TemporaryCollectionType = ReflectionUtils.MakeGenericType(typeof(List<>), CollectionItemType);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
// types that implement IEnumerable and nothing else
|
||||
canDeserialize = false;
|
||||
ShouldCreateWrapper = true;
|
||||
}
|
||||
|
||||
CanDeserialize = canDeserialize;
|
||||
@@ -183,7 +192,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
{
|
||||
Type tempCollectionItemType = tempCollectionType.GetGenericArguments()[0];
|
||||
if (ReflectionUtils.IsNullableType(tempCollectionItemType))
|
||||
_createWrapper = true;
|
||||
ShouldCreateWrapper = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
case JsonContractType.Array:
|
||||
JsonArrayContract arrayContract = (JsonArrayContract) valueContract;
|
||||
if (!arrayContract.IsMultidimensionalArray)
|
||||
SerializeList(writer, (value.ShouldCreateWrapper) ? arrayContract.CreateWrapper(value) : (IList) value, arrayContract, member, containerContract, containerProperty);
|
||||
SerializeList(writer, (value is IList) ? (IList)value : arrayContract.CreateWrapper(value), arrayContract, member, containerContract, containerProperty);
|
||||
else
|
||||
SerializeMultidimensionalArray(writer, (Array)value, arrayContract, member, containerContract, containerProperty);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user