From 68d160f3c608cd6850b207143b2ba69151500613 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Sat, 10 Sep 2016 23:54:44 +1200 Subject: [PATCH] -Added netstandard1.1 with BigInteger support --- Build/Newtonsoft.Json.nuspec | 25 ++++++++ .../Bson/BsonReaderTests.cs | 4 +- .../Bson/BsonWriterTests.cs | 4 +- .../Converters/XmlNodeConverterTest.cs | 2 +- Src/Newtonsoft.Json.Tests/JsonConvertTest.cs | 4 +- .../JsonTextReaderTest.cs | 6 +- .../JsonValidatingReaderTests.cs | 6 +- .../Linq/DynamicTests.cs | 26 ++++---- .../Linq/JTokenReaderTest.cs | 6 +- Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs | 10 +-- .../Linq/JTokenWriterTest.cs | 8 +-- Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs | 16 ++--- .../Linq/JsonPath/JPathExecuteTests.cs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../Serialization/JsonSerializerTest.cs | 8 +-- .../Serialization/TraceWriterTests.cs | 4 +- Src/Newtonsoft.Json.Tests/project.json | 2 +- Src/Newtonsoft.Json/Bson/BsonWriter.cs | 4 +- .../Converters/XmlNodeConverter.cs | 4 +- Src/Newtonsoft.Json/JsonConvert.cs | 6 +- Src/Newtonsoft.Json/JsonReader.cs | 6 +- Src/Newtonsoft.Json/JsonTextReader.cs | 8 +-- Src/Newtonsoft.Json/JsonTextWriter.cs | 4 +- Src/Newtonsoft.Json/JsonValidatingReader.cs | 4 +- Src/Newtonsoft.Json/JsonWriter.cs | 8 +-- Src/Newtonsoft.Json/Linq/JToken.cs | 64 +++++++++---------- Src/Newtonsoft.Json/Linq/JTokenWriter.cs | 4 +- Src/Newtonsoft.Json/Linq/JValue.cs | 14 ++-- .../Properties/AssemblyInfo.cs | 4 +- .../Schema/JsonSchemaGenerator.cs | 2 +- .../JsonSerializerInternalReader.cs | 4 +- .../Serialization/TraceJsonWriter.cs | 4 +- Src/Newtonsoft.Json/Utilities/ConvertUtils.cs | 8 +-- .../Utilities/ReflectionUtils.cs | 4 +- Src/Newtonsoft.Json/project.json | 35 +++++++++- 35 files changed, 194 insertions(+), 132 deletions(-) diff --git a/Build/Newtonsoft.Json.nuspec b/Build/Newtonsoft.Json.nuspec index e5418d7b..f20220e4 100644 --- a/Build/Newtonsoft.Json.nuspec +++ b/Build/Newtonsoft.Json.nuspec @@ -18,6 +18,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs index 0eb3dbd2..c5d80a66 100644 --- a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs +++ b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs @@ -30,7 +30,7 @@ using System.Reflection; using System.Runtime.Serialization; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -1508,7 +1508,7 @@ namespace Newtonsoft.Json.Tests.Bson } #endif -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 public class BigIntegerTestClass { public BigInteger Blah { get; set; } diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs index ec8c58ca..e0ca4cf6 100644 --- a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -800,7 +800,7 @@ namespace Newtonsoft.Json.Tests.Bson Assert.AreEqual(c.AGuid, c2.AGuid.ToString()); } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void WriteBigInteger() { diff --git a/Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs b/Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs index 2bdc0af2..a4bcae4c 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs @@ -2676,7 +2676,7 @@ namespace Newtonsoft.Json.Tests.Converters Assert.AreEqual(@"AsdAAAadad", xmlBack.OuterXml); } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void DeserializeBigInteger() { diff --git a/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs b/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs index e56a551a..961d7f81 100644 --- a/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs @@ -28,7 +28,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using Newtonsoft.Json.Schema; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Runtime.Serialization; @@ -1202,7 +1202,7 @@ namespace Newtonsoft.Json.Tests writer.Flush(); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 [Test] public void IntegerLengthOverflows() { diff --git a/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs b/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs index 853daeae..72eb2f10 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs @@ -28,7 +28,7 @@ using System.Collections; using System.Collections.Generic; using System.Globalization; using Newtonsoft.Json.Linq; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -344,7 +344,7 @@ second line third line", jsonTextReader.Value); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 [Test] public void ReadBigInteger() { @@ -1245,7 +1245,7 @@ third line", jsonTextReader.Value); } } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 [Test] public void ReadInt64Overflow() { diff --git a/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs b/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs index a20ecd13..d4dc768c 100644 --- a/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs +++ b/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs @@ -30,7 +30,7 @@ using System.IO; #if NET20 using Newtonsoft.Json.Utilities.LinqBridge; #endif -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -357,7 +357,7 @@ namespace Newtonsoft.Json.Tests Assert.IsNotNull(validationEventArgs); } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void IntegerGreaterThanMaximumValue_BigInteger() { @@ -610,7 +610,7 @@ namespace Newtonsoft.Json.Tests Assert.IsNotNull(validationEventArgs); } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void BigIntegerDivisibleBy_Success() { diff --git a/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs b/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs index 7d70012d..dc9f863a 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Dynamic; using System.Linq; -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -263,7 +263,7 @@ namespace Newtonsoft.Json.Tests.Linq new JProperty("Uri", new Uri("http://json.codeplex.com/")), new JProperty("Guid", new Guid("EA27FE1D-0D80-44F2-BF34-4654156FA7AF")), new JProperty("TimeSpan", TimeSpan.FromDays(1)) -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 , new JProperty("BigInteger", BigInteger.Parse("1")) #endif ); @@ -296,7 +296,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.IsTrue(d.Decimal == 1.1m); Assert.IsTrue(d.Decimal != 1.0f); Assert.IsTrue(d.Decimal != 1.0d); -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 Assert.IsTrue(d.Decimal > new BigInteger(0)); #endif @@ -312,11 +312,11 @@ namespace Newtonsoft.Json.Tests.Linq Assert.IsTrue(d.Float == 1.1m); Assert.IsTrue(d.Float != 1.0f); Assert.IsTrue(d.Float != 1.0d); -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 Assert.IsTrue(d.Float > new BigInteger(0)); #endif -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 Assert.IsTrue(d.BigInteger == d.BigInteger); Assert.IsTrue(d.BigInteger > 0); Assert.IsTrue(d.BigInteger > 0.0m); @@ -372,7 +372,7 @@ namespace Newtonsoft.Json.Tests.Linq new JProperty("Uri", new Uri("http://json.codeplex.com/")), new JProperty("Guid", new Guid("EA27FE1D-0D80-44F2-BF34-4654156FA7AF")), new JProperty("TimeSpan", TimeSpan.FromDays(1)) -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 , new JProperty("BigInteger", new BigInteger(100)) #endif ); @@ -451,7 +451,7 @@ namespace Newtonsoft.Json.Tests.Linq r += 2; Assert.AreEqual(null, r.Value); -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 r = d.BigInteger + null; Assert.AreEqual(null, r.Value); r += 2; @@ -530,7 +530,7 @@ namespace Newtonsoft.Json.Tests.Linq r -= 2; Assert.AreEqual(null, r.Value); -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 r = d.BigInteger - null; Assert.AreEqual(null, r.Value); r -= 2; @@ -604,7 +604,7 @@ namespace Newtonsoft.Json.Tests.Linq r *= 2; Assert.AreEqual(null, r.Value); -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 r = d.BigInteger * 1.1d; Assert.AreEqual(100m, (decimal)r); r *= 2; @@ -678,7 +678,7 @@ namespace Newtonsoft.Json.Tests.Linq r /= 2; Assert.AreEqual(null, r.Value); -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 r = d.BigInteger / 1.1d; Assert.AreEqual(100m, (decimal)r); r /= 2; @@ -706,7 +706,7 @@ namespace Newtonsoft.Json.Tests.Linq new JProperty("Uri", new Uri("http://json.codeplex.com/")), new JProperty("Guid", new Guid("EA27FE1D-0D80-44F2-BF34-4654156FA7AF")), new JProperty("TimeSpan", TimeSpan.FromDays(1)) -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 , new JProperty("BigInteger", new BigInteger(100)) #endif ); @@ -723,7 +723,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.AreEqual("http://json.codeplex.com/", d.Uri.ToString()); Assert.AreEqual("ea27fe1d-0d80-44f2-bf34-4654156fa7af", d.Guid.ToString()); Assert.AreEqual("1.00:00:00", d.TimeSpan.ToString()); -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 Assert.AreEqual("100", d.BigInteger.ToString()); #endif } @@ -807,7 +807,7 @@ namespace Newtonsoft.Json.Tests.Linq AssertValueConverted(null); AssertValueConverted(new Uri("http://json.codeplex.com/")); AssertValueConverted(null); -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 AssertValueConverted(new BigInteger(100)); AssertValueConverted(null); #endif diff --git a/Src/Newtonsoft.Json.Tests/Linq/JTokenReaderTest.cs b/Src/Newtonsoft.Json.Tests/Linq/JTokenReaderTest.cs index e459fa1c..501eea21 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JTokenReaderTest.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JTokenReaderTest.cs @@ -39,7 +39,7 @@ using NUnit.Framework; #endif using Newtonsoft.Json; using System.IO; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using Newtonsoft.Json.Linq; @@ -51,7 +51,7 @@ namespace Newtonsoft.Json.Tests.Linq [TestFixture] public class JTokenReaderTest : TestFixtureBase { -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 [Test] public void ConvertBigIntegerToDouble() { @@ -876,7 +876,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.AreEqual(1d, reader.ReadAsDouble()); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 [Test] public void ReadAsBoolean_BigInteger_Success() { diff --git a/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs index 54f6cf9c..823c5e79 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -372,7 +372,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.AreEqual(5, (int)(new JValue(StringComparison.OrdinalIgnoreCase))); -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 string bigIntegerText = "1234567899999999999999999999999999999999999999999999999999999999999990"; Assert.AreEqual(BigInteger.Parse(bigIntegerText), (new JValue(BigInteger.Parse(bigIntegerText))).Value); @@ -452,7 +452,7 @@ namespace Newtonsoft.Json.Tests.Linq #endif ExceptionAssert.Throws(() => { var i = (Uri)new JValue(true); }, "Can not convert Boolean to Uri."); -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 ExceptionAssert.Throws(() => { var i = (new JValue(new Uri("http://www.google.com"))).ToObject(); }, "Can not convert Uri to BigInteger."); ExceptionAssert.Throws(() => { var i = (JValue.CreateNull()).ToObject(); }, "Can not convert Null to BigInteger."); ExceptionAssert.Throws(() => { var i = (new JValue(Guid.NewGuid())).ToObject(); }, "Can not convert Guid to BigInteger."); @@ -469,7 +469,7 @@ namespace Newtonsoft.Json.Tests.Linq [Test] public void ToObject() { -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 Assert.AreEqual((BigInteger)1, (new JValue(1).ToObject(typeof(BigInteger)))); Assert.AreEqual((BigInteger)1, (new JValue(1).ToObject(typeof(BigInteger?)))); Assert.AreEqual((BigInteger?)null, (JValue.CreateNull().ToObject(typeof(BigInteger?)))); @@ -526,7 +526,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.IsTrue(JToken.DeepEquals(new JValue((DateTimeOffset?)null), (JValue)(DateTimeOffset?)null)); #endif -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 // had to remove implicit casting to avoid user reference to System.Numerics.dll Assert.IsTrue(JToken.DeepEquals(new JValue(new BigInteger(1)), new JValue(new BigInteger(1)))); Assert.IsTrue(JToken.DeepEquals(new JValue((BigInteger?)null), new JValue((BigInteger?)null))); diff --git a/Src/Newtonsoft.Json.Tests/Linq/JTokenWriterTest.cs b/Src/Newtonsoft.Json.Tests/Linq/JTokenWriterTest.cs index 174ec9c1..7a86e3d0 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JTokenWriterTest.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JTokenWriterTest.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -124,7 +124,7 @@ namespace Newtonsoft.Json.Tests.Linq jsonWriter.WriteValue("DVD read/writer"); Assert.AreEqual(WriteState.Array, jsonWriter.WriteState); -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 jsonWriter.WriteValue(new BigInteger(123)); Assert.AreEqual(WriteState.Array, jsonWriter.WriteState); #endif @@ -176,7 +176,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.AreEqual(WriteState.Array, jsonWriter.WriteState); Assert.AreEqual(a[a.Count - 1], jsonWriter.CurrentToken); -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 jsonWriter.WriteValue(new BigInteger(123)); Assert.AreEqual(WriteState.Array, jsonWriter.WriteState); Assert.AreEqual(a[a.Count - 1], jsonWriter.CurrentToken); @@ -209,7 +209,7 @@ namespace Newtonsoft.Json.Tests.Linq /*fail*/]", writer.Token.ToString()); } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void WriteBigInteger() { diff --git a/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs index 4cb64fe1..bafe8275 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs @@ -28,7 +28,7 @@ using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; using Newtonsoft.Json.Tests.TestObjects; -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -183,7 +183,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.AreEqual(g, v.Value); Assert.AreEqual(JTokenType.Guid, v.Type); -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 BigInteger i = BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990"); v.Value = i; Assert.AreEqual(i, v.Value); @@ -243,13 +243,13 @@ namespace Newtonsoft.Json.Tests.Linq v = new JValue(new Guid("B282ADE7-C520-496C-A448-4084F6803DE5")); Assert.AreEqual("b282ade7-c520-496c-a448-4084f6803de5", v.ToString(null, CultureInfo.InvariantCulture)); -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 v = new JValue(BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990")); Assert.AreEqual("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990", v.ToString(null, CultureInfo.InvariantCulture)); #endif } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void JValueParse() { @@ -517,7 +517,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.AreEqual(Int32.MaxValue, Convert.ToInt32(new JValue(Int32.MaxValue))); } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void ConvertsToInt32_BigInteger() { @@ -679,7 +679,7 @@ namespace Newtonsoft.Json.Tests.Linq v = new JValue(new Uri("http://www.google.com")); Assert.AreEqual(TypeCode.Object, v.GetTypeCode()); -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 v = new JValue(new BigInteger(3)); Assert.AreEqual(TypeCode.Object, v.GetTypeCode()); #endif @@ -698,7 +698,7 @@ namespace Newtonsoft.Json.Tests.Linq int i = (int)v.ToType(typeof(int), CultureInfo.InvariantCulture); Assert.AreEqual(9, i); -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 BigInteger bi = (BigInteger)v.ToType(typeof(BigInteger), CultureInfo.InvariantCulture); Assert.AreEqual(new BigInteger(9), bi); #endif @@ -713,7 +713,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.AreEqual("2013", v.ToString("yyyy")); } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void ToStringNewTypes() { diff --git a/Src/Newtonsoft.Json.Tests/Linq/JsonPath/JPathExecuteTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JsonPath/JPathExecuteTests.cs index 16723166..d4cea700 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JsonPath/JPathExecuteTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JsonPath/JPathExecuteTests.cs @@ -26,7 +26,7 @@ using System; using System.Collections.Generic; using System.Text; -#if !(PORTABLE || PORTABLE40 || NET35 || NET20) +#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1 using System.Numerics; #endif using Newtonsoft.Json.Linq.JsonPath; @@ -652,7 +652,7 @@ namespace Newtonsoft.Json.Tests.Linq.JsonPath Assert.IsTrue(JToken.DeepEquals(new JObject(new JProperty("hi", 3)), t[1])); } -#if !(PORTABLE || DNXCORE50 || PORTABLE40 || NET35 || NET20) +#if !(PORTABLE || DNXCORE50 || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1 [Test] public void GreaterQueryBigInteger() { diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs index 9356d94e..1e670b15 100644 --- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs @@ -31,8 +31,10 @@ using System.Security; // set of attributes. Change these attribute values to modify the information // associated with an assembly. -#if NETSTANDARD10 +#if NETSTANDARD1_0 [assembly: AssemblyTitle("Json.NET Tests .NET Standard 1.0")] +#elif NETSTANDARD1_1 +[assembly: AssemblyTitle("Json.NET Tests .NET Standard 1.1")] #elif PORTABLE40 [assembly: AssemblyTitle("Json.NET Tests Portable .NET 4.0")] #elif PORTABLE diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs index 2d2d9797..13c51028 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs @@ -29,7 +29,7 @@ using System.ComponentModel; using System.Collections.Concurrent; #endif using System.Collections.Generic; -#if !(NET20 || NET35 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif #if !(NET20 || NETFX_CORE || DNXCORE50) @@ -8208,7 +8208,7 @@ Path '', line 1, position 1."); } #if !(NET20 || NET35 || NET40 || PORTABLE40) -#if !PORTABLE +#if !PORTABLE || NETSTANDARD1_1 [Test] public void DeserializeReadOnlyListWithBigInteger() { @@ -8551,7 +8551,7 @@ Path '', line 1, position 1."); } #endif -#if !(PORTABLE || NET35 || NET20 || PORTABLE40) +#if !(PORTABLE || NET35 || NET20 || PORTABLE40) || NETSTANDARD1_1 [Test] public void ReadTooLargeInteger() { @@ -8734,7 +8734,7 @@ Path '', line 1, position 1."); } #endif -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void SerializeBigInteger() { diff --git a/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs index 010e2c46..7619c716 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Globalization; using System.IO; using Newtonsoft.Json.Linq; -#if !(NET20 || NET35 || PORTABLE ||PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 using System.Numerics; #endif using System.Runtime.Serialization; @@ -879,7 +879,7 @@ Newtonsoft.Json Error: 0 : Error! Assert.AreEqual(23, deserialized.FavoriteNumber); } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 [Test] public void TraceJsonWriterTest() { diff --git a/Src/Newtonsoft.Json.Tests/project.json b/Src/Newtonsoft.Json.Tests/project.json index 3b4afefc..9f780328 100644 --- a/Src/Newtonsoft.Json.Tests/project.json +++ b/Src/Newtonsoft.Json.Tests/project.json @@ -84,7 +84,7 @@ },*/ "netcoreapp1.0": { "buildOptions": { - "define": [ "NETSTANDARD10", "DNXCORE50", "PORTABLE" ] + "define": [ "NETSTANDARD1_1", "DNXCORE50", "PORTABLE" ] }, "dependencies": { "Microsoft.NETCore.App": { diff --git a/Src/Newtonsoft.Json/Bson/BsonWriter.cs b/Src/Newtonsoft.Json/Bson/BsonWriter.cs index 2c0c2ff9..690babe3 100644 --- a/Src/Newtonsoft.Json/Bson/BsonWriter.cs +++ b/Src/Newtonsoft.Json/Bson/BsonWriter.cs @@ -27,7 +27,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.IO; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -232,7 +232,7 @@ namespace Newtonsoft.Json.Bson /// The value to write. public override void WriteValue(object value) { -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 if (value is BigInteger) { InternalWriteValue(JsonToken.Integer); diff --git a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs index 5e91bf94..ee56c1ff 100644 --- a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs @@ -24,7 +24,7 @@ #endregion #if !PORTABLE40 -#if !(PORTABLE || NET20 || NET35) +#if !(PORTABLE || NET20 || NET35) || NETSTANDARD1_1 using System.Numerics; #endif using System; @@ -1635,7 +1635,7 @@ namespace Newtonsoft.Json.Converters } else if (reader.TokenType == JsonToken.Integer) { -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 if (reader.Value is BigInteger) { return ((BigInteger)reader.Value).ToString(CultureInfo.InvariantCulture); diff --git a/Src/Newtonsoft.Json/JsonConvert.cs b/Src/Newtonsoft.Json/JsonConvert.cs index e1021b4a..936ecb10 100644 --- a/Src/Newtonsoft.Json/JsonConvert.cs +++ b/Src/Newtonsoft.Json/JsonConvert.cs @@ -26,7 +26,7 @@ using System; using System.IO; using System.Globalization; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif #if !(NET20 || NET35 || PORTABLE40) @@ -238,7 +238,7 @@ namespace Newtonsoft.Json return value.ToString(null, CultureInfo.InvariantCulture); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 private static string ToStringInternal(BigInteger value) { return value.ToString(null, CultureInfo.InvariantCulture); @@ -510,7 +510,7 @@ namespace Newtonsoft.Json return ToString((Uri)value); case PrimitiveTypeCode.TimeSpan: return ToString((TimeSpan)value); -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 case PrimitiveTypeCode.BigInteger: return ToStringInternal((BigInteger)value); #endif diff --git a/Src/Newtonsoft.Json/JsonReader.cs b/Src/Newtonsoft.Json/JsonReader.cs index 4df922cb..d0d319aa 100644 --- a/Src/Newtonsoft.Json/JsonReader.cs +++ b/Src/Newtonsoft.Json/JsonReader.cs @@ -27,7 +27,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Globalization; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using Newtonsoft.Json.Serialization; @@ -623,7 +623,7 @@ namespace Newtonsoft.Json if (!(Value is double)) { double d; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (Value is BigInteger) { d = (double)(BigInteger)Value; @@ -683,7 +683,7 @@ namespace Newtonsoft.Json case JsonToken.Integer: case JsonToken.Float: bool b; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (Value is BigInteger) { b = (BigInteger)Value != 0; diff --git a/Src/Newtonsoft.Json/JsonTextReader.cs b/Src/Newtonsoft.Json/JsonTextReader.cs index cf2ca06b..9b7a239e 100644 --- a/Src/Newtonsoft.Json/JsonTextReader.cs +++ b/Src/Newtonsoft.Json/JsonTextReader.cs @@ -30,7 +30,7 @@ using System.Runtime.CompilerServices; using System.Text; using System.IO; using System.Globalization; -#if !(PORTABLE || PORTABLE40 || NET35 || NET20) +#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1 using System.Numerics; #endif using Newtonsoft.Json.Utilities; @@ -747,7 +747,7 @@ namespace Newtonsoft.Json case '9': ParseNumber(ReadType.Read); bool b; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (Value is BigInteger) { b = (BigInteger)Value != 0; @@ -2022,7 +2022,7 @@ namespace Newtonsoft.Json } else if (parseResult == ParseResult.Overflow) { -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 string number = _stringReference.ToString(); if (number.Length > MaximumJavascriptIntegerCharacterLength) @@ -2076,7 +2076,7 @@ namespace Newtonsoft.Json SetToken(numberType, numberValue, false); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 // By using the BigInteger type in a separate method, // the runtime can execute the ParseNumber even if // the System.Numerics.BigInteger.Parse method is diff --git a/Src/Newtonsoft.Json/JsonTextWriter.cs b/Src/Newtonsoft.Json/JsonTextWriter.cs index 8367846c..f15ec748 100644 --- a/Src/Newtonsoft.Json/JsonTextWriter.cs +++ b/Src/Newtonsoft.Json/JsonTextWriter.cs @@ -26,7 +26,7 @@ using System; using System.Collections.Generic; using System.Globalization; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -359,7 +359,7 @@ namespace Newtonsoft.Json /// The value to write. public override void WriteValue(object value) { -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 if (value is BigInteger) { InternalWriteValue(JsonToken.Integer); diff --git a/Src/Newtonsoft.Json/JsonValidatingReader.cs b/Src/Newtonsoft.Json/JsonValidatingReader.cs index 6e5d75a1..c8a88966 100644 --- a/Src/Newtonsoft.Json/JsonValidatingReader.cs +++ b/Src/Newtonsoft.Json/JsonValidatingReader.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using Newtonsoft.Json.Linq; @@ -840,7 +840,7 @@ namespace Newtonsoft.Json if (schema.DivisibleBy != null) { bool notDivisible; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (value is BigInteger) { // not that this will lose any decimal point on DivisibleBy diff --git a/Src/Newtonsoft.Json/JsonWriter.cs b/Src/Newtonsoft.Json/JsonWriter.cs index 40fa2bce..2d15f99a 100644 --- a/Src/Newtonsoft.Json/JsonWriter.cs +++ b/Src/Newtonsoft.Json/JsonWriter.cs @@ -26,7 +26,7 @@ using System; using System.Collections.Generic; using System.IO; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using Newtonsoft.Json.Utilities; @@ -532,7 +532,7 @@ namespace Newtonsoft.Json break; case JsonToken.Integer: ValidationUtils.ArgumentNotNull(value, nameof(value)); -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 if (value is BigInteger) { WriteValue((BigInteger)value); @@ -1392,7 +1392,7 @@ namespace Newtonsoft.Json } else { -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 // this is here because adding a WriteValue(BigInteger) to JsonWriter will // mean the user has to add a reference to System.Numerics.dll if (value is BigInteger) @@ -1550,7 +1550,7 @@ namespace Newtonsoft.Json case PrimitiveTypeCode.TimeSpanNullable: writer.WriteValue((value == null) ? (TimeSpan?)null : (TimeSpan)value); break; -#if !(PORTABLE || PORTABLE40 || NET35 || NET20) +#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1 case PrimitiveTypeCode.BigInteger: // this will call to WriteValue(object) writer.WriteValue((BigInteger)value); diff --git a/Src/Newtonsoft.Json/Linq/JToken.cs b/Src/Newtonsoft.Json/Linq/JToken.cs index fe5aa977..06d4a3c8 100644 --- a/Src/Newtonsoft.Json/Linq/JToken.cs +++ b/Src/Newtonsoft.Json/Linq/JToken.cs @@ -31,7 +31,7 @@ using System.Dynamic; using System.Linq.Expressions; #endif using System.IO; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -68,7 +68,7 @@ namespace Newtonsoft.Json.Linq private static readonly JTokenType[] BooleanTypes = new[] { JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean }; private static readonly JTokenType[] NumberTypes = new[] { JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean }; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 private static readonly JTokenType[] BigIntegerTypes = new[] { JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean, JTokenType.Bytes }; #endif private static readonly JTokenType[] StringTypes = new[] { JTokenType.Date, JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean, JTokenType.Bytes, JTokenType.Guid, JTokenType.TimeSpan, JTokenType.Uri }; @@ -492,7 +492,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return Convert.ToBoolean((int)(BigInteger)v.Value); @@ -546,7 +546,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return Convert.ToBoolean((int)(BigInteger)v.Value); @@ -569,7 +569,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (long)(BigInteger)v.Value; @@ -660,7 +660,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (decimal?)(BigInteger)v.Value; @@ -688,7 +688,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (double?)(BigInteger)v.Value; @@ -716,7 +716,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (char?)(BigInteger)v.Value; @@ -739,7 +739,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (int)(BigInteger)v.Value; @@ -762,7 +762,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (short)(BigInteger)v.Value; @@ -786,7 +786,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (ushort)(BigInteger)v.Value; @@ -810,7 +810,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (char)(BigInteger)v.Value; @@ -833,7 +833,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (byte)(BigInteger)v.Value; @@ -857,7 +857,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to SByte.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (sbyte)(BigInteger)v.Value; @@ -885,7 +885,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (int?)(BigInteger)v.Value; @@ -913,7 +913,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (short?)(BigInteger)v.Value; @@ -942,7 +942,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (ushort?)(BigInteger)v.Value; @@ -970,7 +970,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (byte?)(BigInteger)v.Value; @@ -999,7 +999,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to SByte.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (sbyte?)(BigInteger)v.Value; @@ -1050,7 +1050,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (long?)(BigInteger)v.Value; @@ -1078,7 +1078,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (float?)(BigInteger)v.Value; @@ -1101,7 +1101,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (decimal)(BigInteger)v.Value; @@ -1130,7 +1130,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (uint?)(BigInteger)v.Value; @@ -1159,7 +1159,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (ulong?)(BigInteger)v.Value; @@ -1182,7 +1182,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (double)(BigInteger)v.Value; @@ -1205,7 +1205,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (float)(BigInteger)v.Value; @@ -1241,7 +1241,7 @@ namespace Newtonsoft.Json.Linq { return Convert.ToBase64String((byte[])v.Value); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return ((BigInteger)v.Value).ToString(CultureInfo.InvariantCulture); @@ -1265,7 +1265,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (uint)(BigInteger)v.Value; @@ -1289,7 +1289,7 @@ namespace Newtonsoft.Json.Linq throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value))); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return (ulong)(BigInteger)v.Value; @@ -1321,7 +1321,7 @@ namespace Newtonsoft.Json.Linq { return Convert.FromBase64String(Convert.ToString(v.Value, CultureInfo.InvariantCulture)); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (v.Value is BigInteger) { return ((BigInteger)v.Value).ToByteArray(); @@ -1456,7 +1456,7 @@ namespace Newtonsoft.Json.Linq return (v.Value is Uri) ? (Uri)v.Value : new Uri(Convert.ToString(v.Value, CultureInfo.InvariantCulture)); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 private static BigInteger ToBigInteger(JToken value) { JValue v = EnsureValue(value); @@ -2035,7 +2035,7 @@ namespace Newtonsoft.Json.Linq return (TimeSpan?)this; case PrimitiveTypeCode.TimeSpan: return (TimeSpan)this; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 case PrimitiveTypeCode.BigIntegerNullable: return ToBigIntegerNullable(this); case PrimitiveTypeCode.BigInteger: diff --git a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs index 86e5d954..e9551b07 100644 --- a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs @@ -25,7 +25,7 @@ using System; using System.Globalization; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using Newtonsoft.Json.Utilities; @@ -221,7 +221,7 @@ namespace Newtonsoft.Json.Linq /// The value to write. public override void WriteValue(object value) { -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 if (value is BigInteger) { InternalWriteValue(JsonToken.Integer); diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index d6d6b30e..4ed0ad7a 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -31,7 +31,7 @@ using System.Globalization; using System.Dynamic; using System.Linq.Expressions; #endif -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif @@ -219,7 +219,7 @@ namespace Newtonsoft.Json.Linq get { return false; } } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 private static int CompareBigInteger(BigInteger i1, object i2) { int result = i1.CompareTo(ConvertUtils.ToBigInteger(i2)); @@ -264,7 +264,7 @@ namespace Newtonsoft.Json.Linq switch (valueType) { case JTokenType.Integer: -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (objA is BigInteger) { return CompareBigInteger((BigInteger)objA, objB); @@ -287,7 +287,7 @@ namespace Newtonsoft.Json.Linq return Convert.ToInt64(objA, CultureInfo.InvariantCulture).CompareTo(Convert.ToInt64(objB, CultureInfo.InvariantCulture)); } case JTokenType.Float: -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (objA is BigInteger) { return CompareBigInteger((BigInteger)objA, objB); @@ -428,7 +428,7 @@ namespace Newtonsoft.Json.Linq } } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (objA is BigInteger || objB is BigInteger) { if (objA == null || objB == null) @@ -632,7 +632,7 @@ namespace Newtonsoft.Json.Linq { return JTokenType.Integer; } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 else if (value is BigInteger) { return JTokenType.Integer; @@ -768,7 +768,7 @@ namespace Newtonsoft.Json.Linq { writer.WriteValue((ulong)_value); } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 else if (_value is BigInteger) { writer.WriteValue((BigInteger)_value); diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs index 62cc370e..5c0b716a 100644 --- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -32,8 +32,10 @@ using System.Security; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -#if NETSTANDARD10 +#if NETSTANDARD1_0 [assembly: AssemblyTitle("Json.NET .NET Standard 1.0")] +#elif NETSTANDARD1_1 +[assembly: AssemblyTitle("Json.NET .NET Standard 1.1")] #elif PORTABLE40 [assembly: AssemblyTitle("Json.NET Portable .NET 4.0")] #elif PORTABLE diff --git a/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs b/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs index f003fdc6..0a7d2854 100644 --- a/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs +++ b/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs @@ -487,7 +487,7 @@ namespace Newtonsoft.Json.Schema case PrimitiveTypeCode.UInt32: case PrimitiveTypeCode.Int64: case PrimitiveTypeCode.UInt64: -#if !(PORTABLE || NET35 || NET20) +#if !(PORTABLE || NET35 || NET20) || NETSTANDARD1_1 case PrimitiveTypeCode.BigInteger: #endif return schemaType | JsonSchemaType.Integer; diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs index 2551f6cd..653810b3 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs @@ -33,7 +33,7 @@ using System.Dynamic; #endif using System.Diagnostics; using System.Globalization; -#if !(PORTABLE || PORTABLE40 || NET35 || NET20) +#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1 using System.Numerics; #endif using System.Reflection; @@ -966,7 +966,7 @@ namespace Newtonsoft.Json.Serialization } } -#if !(PORTABLE || PORTABLE40 || NET35 || NET20) +#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1 if (value is BigInteger) { return ConvertUtils.FromBigInteger((BigInteger)value, contract.NonNullableUnderlyingType); diff --git a/Src/Newtonsoft.Json/Serialization/TraceJsonWriter.cs b/Src/Newtonsoft.Json/Serialization/TraceJsonWriter.cs index f943d06f..c37e4d4a 100644 --- a/Src/Newtonsoft.Json/Serialization/TraceJsonWriter.cs +++ b/Src/Newtonsoft.Json/Serialization/TraceJsonWriter.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -139,7 +139,7 @@ namespace Newtonsoft.Json.Serialization public override void WriteValue(object value) { -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 if (value is BigInteger) { _textWriter.WriteValue(value); diff --git a/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs b/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs index 227db86d..7ff9ecde 100644 --- a/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs @@ -27,7 +27,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.ComponentModel; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 using System.Numerics; #endif using System.Text; @@ -145,7 +145,7 @@ namespace Newtonsoft.Json.Utilities { typeof(Guid?), PrimitiveTypeCode.GuidNullable }, { typeof(TimeSpan), PrimitiveTypeCode.TimeSpan }, { typeof(TimeSpan?), PrimitiveTypeCode.TimeSpanNullable }, -#if !(PORTABLE || PORTABLE40 || NET35 || NET20) +#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1 { typeof(BigInteger), PrimitiveTypeCode.BigInteger }, { typeof(BigInteger?), PrimitiveTypeCode.BigIntegerNullable }, #endif @@ -311,7 +311,7 @@ namespace Newtonsoft.Json.Utilities return o => call(null, o); } -#if !(NET20 || NET35 || PORTABLE || PORTABLE40) +#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1 internal static BigInteger ToBigInteger(object value) { if (value is BigInteger) @@ -540,7 +540,7 @@ namespace Newtonsoft.Json.Utilities } } -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) +#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1 if (targetType == typeof(BigInteger)) { value = ToBigInteger(initialValue); diff --git a/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs index 637db561..a4b73df2 100644 --- a/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if !(PORTABLE || PORTABLE40 || NET35 || NET20) +#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1 using System.Numerics; #endif using System.Reflection; @@ -1105,7 +1105,7 @@ namespace Newtonsoft.Json.Utilities return 0m; case PrimitiveTypeCode.DateTime: return new DateTime(); -#if !(PORTABLE || PORTABLE40 || NET35 || NET20) +#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1 case PrimitiveTypeCode.BigInteger: return new BigInteger(); #endif diff --git a/Src/Newtonsoft.Json/project.json b/Src/Newtonsoft.Json/project.json index 4be92250..604d2999 100644 --- a/Src/Newtonsoft.Json/project.json +++ b/Src/Newtonsoft.Json/project.json @@ -101,7 +101,7 @@ "netstandard1.0": { "buildOptions": { "define": [ - "NETSTANDARD10", + "NETSTANDARD1_0", "PORTABLE" ] }, @@ -129,6 +129,39 @@ "System.Xml.ReaderWriter": "4.0.11", "System.Xml.XDocument": "4.0.11" } + }, + "netstandard1.1": { + "buildOptions": { + "define": [ + "NETSTANDARD1_1", + "PORTABLE" + ] + }, + "dependencies": { + "Microsoft.CSharp": "4.0.1", + "System.Collections": "4.0.11", + "System.Diagnostics.Debug": "4.0.11", + "System.Dynamic.Runtime": "4.0.11", + "System.Globalization": "4.0.11", + "System.IO": "4.1.0", + "System.Linq": "4.1.0", + "System.Linq.Expressions": "4.1.0", + "System.ObjectModel": "4.0.12", + "System.Reflection": "4.1.0", + "System.Reflection.Extensions": "4.0.1", + "System.Resources.ResourceManager": "4.0.1", + "System.Runtime": "4.1.0", + "System.Runtime.Extensions": "4.1.0", + "System.Runtime.Numerics": "4.0.1", + "System.Runtime.Serialization.Primitives": "4.1.1", + "System.Text.Encoding": "4.0.11", + "System.Text.Encoding.Extensions": "4.0.11", + "System.Text.RegularExpressions": "4.1.0", + "System.Threading": "4.0.11", + "System.Threading.Tasks": "4.0.11", + "System.Xml.ReaderWriter": "4.0.11", + "System.Xml.XDocument": "4.0.11" + } } } } \ No newline at end of file