Skip to content

Commit

Permalink
-Fixed deserializing large nullable UInt64 values
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Feb 25, 2015
1 parent dd611a9 commit 376ab4d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
Expand Up @@ -8588,6 +8588,28 @@ public void DeserializedDerivedWithPrivate()
Assert.AreEqual("derived", d.DerivedProperty);
}

[Test]
public void DeserializeNullableUnsignedLong()
{
NullableLongTestClass instance = new NullableLongTestClass
{
Value = ulong.MaxValue
};
string output = JsonConvert.SerializeObject(instance);
NullableLongTestClass result = JsonConvert.DeserializeObject<NullableLongTestClass>(output);

Assert.AreEqual(ulong.MaxValue, result.Value);
}

public class NullableLongTestClass
{
public ulong? Value
{
get;
set;
}
}

#if !NETFX_CORE
[Test]
public void MailMessageConverterTest()
Expand Down
Expand Up @@ -862,7 +862,7 @@ private object EnsureType(JsonReader reader, object value, CultureInfo culture,

#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
if (value is BigInteger)
return ConvertUtils.FromBigInteger((BigInteger)value, targetType);
return ConvertUtils.FromBigInteger((BigInteger)value, contract.NonNullableUnderlyingType);
#endif

// this won't work when converting to a custom IConvertible
Expand Down

0 comments on commit 376ab4d

Please sign in to comment.