-Added dotnet build

-Removed WinRT files
-Updated solution files to VS2015
-Updated psake
This commit is contained in:
James Newton-King
2015-08-02 23:56:26 +12:00
parent 7bad8a73c4
commit fe7b7a6c7b
102 changed files with 507 additions and 1247 deletions
+3
View File
@@ -13,6 +13,9 @@ _ReSharper.*
*.resharper.user
project.lock.json
*.xproj
.vs/
*.props
*.targets
#NuGet
packages
+3 -3
View File
@@ -1,8 +1,8 @@
properties {
$zipFileName = "Json70r1.zip"
$zipFileName = "Json70r2.zip"
$majorVersion = "7.0"
$majorWithReleaseVersion = "7.0.1"
$nugetPrelease = $null
$majorWithReleaseVersion = "7.0.2"
$nugetPrelease = "beta1"
$version = GetVersion $majorWithReleaseVersion
$packageId = "Newtonsoft.Json"
$signAssemblies = $false
+34
View File
@@ -0,0 +1,34 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B520C700-7D45-4D82-BFB5-218FA68CF5CF}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
NuGet.Config = NuGet.Config
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Newtonsoft.Json.Dotnet", "Newtonsoft.Json\Newtonsoft.Json.Dotnet.xproj", "{2ACDB8C2-9BB8-4EB9-8D6A-4BB8CCF89377}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Newtonsoft.Json.Tests.Dotnet", "Newtonsoft.Json.Tests\Newtonsoft.Json.Tests.Dotnet.xproj", "{A1643B3F-D2C4-4312-AA04-07CF1B09A1E9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2ACDB8C2-9BB8-4EB9-8D6A-4BB8CCF89377}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2ACDB8C2-9BB8-4EB9-8D6A-4BB8CCF89377}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2ACDB8C2-9BB8-4EB9-8D6A-4BB8CCF89377}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2ACDB8C2-9BB8-4EB9-8D6A-4BB8CCF89377}.Release|Any CPU.Build.0 = Release|Any CPU
{A1643B3F-D2C4-4312-AA04-07CF1B09A1E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1643B3F-D2C4-4312-AA04-07CF1B09A1E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1643B3F-D2C4-4312-AA04-07CF1B09A1E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1643B3F-D2C4-4312-AA04-07CF1B09A1E9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Net20", "Newtonsoft.Json\Newtonsoft.Json.Net20.csproj", "{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}"
EndProject
+3 -2
View File
@@ -1,7 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30324.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Net35", "Newtonsoft.Json\Newtonsoft.Json.Net35.csproj", "{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Tests.Net35", "Newtonsoft.Json.Tests\Newtonsoft.Json.Tests.Net35.csproj", "{3E6E2335-B079-4B5B-A65A-9D586914BCBB}"
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Net40", "Newtonsoft.Json\Newtonsoft.Json.Net40.csproj", "{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}"
EndProject
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Portable", "Newtonsoft.Json\Newtonsoft.Json.Portable.csproj", "{959F7F85-C98B-4876-971A-9036224578E4}"
EndProject
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Portable40", "Newtonsoft.Json\Newtonsoft.Json.Portable40.csproj", "{959F7F85-C98B-4876-971A-9036224578E4}"
EndProject
@@ -57,4 +57,4 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.1.18621")]
[assembly: AssemblyFileVersion("7.0.2.18802")]
@@ -30,7 +30,7 @@ using System.Reflection;
using System.Runtime.Serialization;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Tests.TestObjects;
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
using System.Numerics;
#endif
using System.Text;
@@ -1506,7 +1506,7 @@ namespace Newtonsoft.Json.Tests.Bson
}
#endif
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
public class BigIntegerTestClass
{
public BigInteger Blah { get; set; }
@@ -25,7 +25,7 @@
using System;
using System.Collections.Generic;
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
using System.Numerics;
#endif
using System.Text;
@@ -803,7 +803,7 @@ namespace Newtonsoft.Json.Tests.Bson
Assert.AreEqual(c.AGuid, c2.AGuid.ToString());
}
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
[Test]
public void WriteBigInteger()
{
@@ -25,10 +25,10 @@
using System;
using System.Collections.Generic;
#if !(NET20 || NETFX_CORE || DNXCORE50)
#if !(NET20 || DNXCORE50)
using System.Data.Linq;
#endif
#if !(NETFX_CORE || DNXCORE50)
#if !DNXCORE50
using System.Data.SqlTypes;
#endif
using System.Text;
@@ -58,7 +58,7 @@ namespace Newtonsoft.Json.Tests.Converters
public byte[] NullByteArray { get; set; }
}
#if !(NET20 || NETFX_CORE || PORTABLE || PORTABLE40 || DNXCORE50)
#if !(NET20 || PORTABLE || PORTABLE40 || DNXCORE50)
[Test]
public void DeserializeBinaryClass()
{
@@ -124,7 +124,7 @@ namespace Newtonsoft.Json.Tests.Converters
}", json);
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40 || DNXCORE50)
#if !(PORTABLE || PORTABLE40 || DNXCORE50)
public class SqlBinaryClass
{
public SqlBinary SqlBinary { get; set; }
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20 || NETFX_CORE || DNXCORE50)
#if !(NET35 || NET20 || DNXCORE50)
using System.Diagnostics;
using System.Reflection;
using Microsoft.FSharp.Core;
@@ -44,32 +44,41 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
[Test]
public void Example()
{
#region Usage
// settings will automatically be used by JsonConvert.SerializeObject/DeserializeObject
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Formatting = Formatting.Indented,
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
string json;
Staff s = new Staff
try
{
FirstName = "Eric",
LastName = "Example",
BirthDate = new DateTime(1980, 4, 20, 0, 0, 0, DateTimeKind.Utc),
Department = "IT",
JobTitle = "Web Dude"
};
#region Usage
// settings will automatically be used by JsonConvert.SerializeObject/DeserializeObject
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Formatting = Formatting.Indented,
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
string json = JsonConvert.SerializeObject(s);
// {
// "firstName": "Eric",
// "lastName": "Example",
// "birthDate": "1980-04-20T00:00:00Z",
// "department": "IT",
// "jobTitle": "Web Dude"
// }
#endregion
Staff s = new Staff
{
FirstName = "Eric",
LastName = "Example",
BirthDate = new DateTime(1980, 4, 20, 0, 0, 0, DateTimeKind.Utc),
Department = "IT",
JobTitle = "Web Dude"
};
json = JsonConvert.SerializeObject(s);
// {
// "firstName": "Eric",
// "lastName": "Example",
// "birthDate": "1980-04-20T00:00:00Z",
// "department": "IT",
// "jobTitle": "Web Dude"
// }
#endregion
}
finally
{
JsonConvert.DefaultSettings = null;
}
StringAssert.AreEqual(@"{
""firstName"": ""Eric"",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

+2 -2
View File
@@ -28,7 +28,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Newtonsoft.Json.Schema;
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
using System.Numerics;
#endif
using System.Runtime.Serialization;
@@ -1132,7 +1132,7 @@ namespace Newtonsoft.Json.Tests
}
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
[Test]
public void IntegerLengthOverflows()
{
@@ -27,7 +27,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json.Linq;
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
using System.Numerics;
#endif
using System.Text;
@@ -138,7 +138,7 @@ second line
third line", jsonTextReader.Value);
}
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
[Test]
public void ReadBigInteger()
{
@@ -1017,7 +1017,7 @@ third line", jsonTextReader.Value);
}
}
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
[Test]
public void ReadInt64Overflow()
{
@@ -121,7 +121,7 @@ namespace Newtonsoft.Json.Tests
Assert.IsTrue(ms.CanRead);
}
#if !(PORTABLE || DNXCORE50 || NETFX_CORE)
#if !(PORTABLE)
[Test]
public void WriteIConvertable()
{
@@ -1552,7 +1552,7 @@ null//comment
}
}
#if !(PORTABLE || DNXCORE50 || NETFX_CORE)
#if !(PORTABLE || NETFX_CORE)
public struct ConvertibleInt : IConvertible
{
private readonly int _value;
@@ -30,7 +30,7 @@ using System.IO;
#if NET20
using Newtonsoft.Json.Utilities.LinqBridge;
#endif
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
using System.Numerics;
#endif
using System.Text;
@@ -357,7 +357,7 @@ namespace Newtonsoft.Json.Tests
Assert.IsNotNull(validationEventArgs);
}
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
[Test]
public void IntegerGreaterThanMaximumValue_BigInteger()
{
@@ -610,7 +610,7 @@ namespace Newtonsoft.Json.Tests
Assert.IsNotNull(validationEventArgs);
}
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
[Test]
public void BigIntegerDivisibleBy_Success()
{
@@ -4,7 +4,17 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
using Xunit;
using TestAttribute = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Linq
{
+13 -13
View File
@@ -29,7 +29,7 @@ using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
using System.Numerics;
#endif
using System.Text;
@@ -255,7 +255,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 || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
, new JProperty("BigInteger", BigInteger.Parse("1"))
#endif
);
@@ -288,7 +288,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 || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
Assert.IsTrue(d.Decimal > new BigInteger(0));
#endif
@@ -304,11 +304,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 || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
Assert.IsTrue(d.Float > new BigInteger(0));
#endif
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
Assert.IsTrue(d.BigInteger == d.BigInteger);
Assert.IsTrue(d.BigInteger > 0);
Assert.IsTrue(d.BigInteger > 0.0m);
@@ -364,7 +364,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 || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
, new JProperty("BigInteger", new BigInteger(100))
#endif
);
@@ -443,7 +443,7 @@ namespace Newtonsoft.Json.Tests.Linq
r += 2;
Assert.AreEqual(null, r.Value);
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
r = d.BigInteger + null;
Assert.AreEqual(null, r.Value);
r += 2;
@@ -522,7 +522,7 @@ namespace Newtonsoft.Json.Tests.Linq
r -= 2;
Assert.AreEqual(null, r.Value);
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
r = d.BigInteger - null;
Assert.AreEqual(null, r.Value);
r -= 2;
@@ -596,7 +596,7 @@ namespace Newtonsoft.Json.Tests.Linq
r *= 2;
Assert.AreEqual(null, r.Value);
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
r = d.BigInteger * 1.1d;
Assert.AreEqual(100m, (decimal)r);
r *= 2;
@@ -670,7 +670,7 @@ namespace Newtonsoft.Json.Tests.Linq
r /= 2;
Assert.AreEqual(null, r.Value);
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
r = d.BigInteger / 1.1d;
Assert.AreEqual(100m, (decimal)r);
r /= 2;
@@ -698,7 +698,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 || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
, new JProperty("BigInteger", new BigInteger(100))
#endif
);
@@ -715,7 +715,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 || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
Assert.AreEqual("100", d.BigInteger.ToString());
#endif
}
@@ -799,7 +799,7 @@ namespace Newtonsoft.Json.Tests.Linq
AssertValueConverted<Guid?>(null);
AssertValueConverted<Uri>(new Uri("http://json.codeplex.com/"));
AssertValueConverted<Uri>(null);
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
AssertValueConverted<BigInteger>(new BigInteger(100));
AssertValueConverted<BigInteger?>(null);
#endif
@@ -27,7 +27,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
using System.Numerics;
#endif
using Newtonsoft.Json.Serialization;
@@ -717,7 +717,7 @@ Parameter name: arrayIndex");
Assert.AreEqual(p4, l[1]);
}
#if !(NET20 || NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || PORTABLE || PORTABLE40)
[Test]
public void PropertyChanging()
{
@@ -25,7 +25,7 @@
using System;
using System.Collections.Generic;
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
using System.Numerics;
#endif
using System.Text;
@@ -361,7 +361,7 @@ namespace Newtonsoft.Json.Tests.Linq
Assert.AreEqual(5, (int)(new JValue(StringComparison.OrdinalIgnoreCase)));
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
string bigIntegerText = "1234567899999999999999999999999999999999999999999999999999999999999990";
Assert.AreEqual(BigInteger.Parse(bigIntegerText), (new JValue(BigInteger.Parse(bigIntegerText))).Value);
@@ -441,7 +441,7 @@ namespace Newtonsoft.Json.Tests.Linq
#endif
ExceptionAssert.Throws<ArgumentException>(() => { var i = (Uri)new JValue(true); }, "Can not convert Boolean to Uri.");
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
ExceptionAssert.Throws<ArgumentException>(() => { var i = (new JValue(new Uri("http://www.google.com"))).ToObject<BigInteger>(); }, "Can not convert Uri to BigInteger.");
ExceptionAssert.Throws<ArgumentException>(() => { var i = (JValue.CreateNull()).ToObject<BigInteger>(); }, "Can not convert Null to BigInteger.");
ExceptionAssert.Throws<ArgumentException>(() => { var i = (new JValue(Guid.NewGuid())).ToObject<BigInteger>(); }, "Can not convert Guid to BigInteger.");
@@ -458,7 +458,7 @@ namespace Newtonsoft.Json.Tests.Linq
[Test]
public void ToObject()
{
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
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?))));
@@ -515,7 +515,7 @@ namespace Newtonsoft.Json.Tests.Linq
Assert.IsTrue(JToken.DeepEquals(new JValue((DateTimeOffset?)null), (JValue)(DateTimeOffset?)null));
#endif
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
// 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)));
@@ -124,7 +124,7 @@ namespace Newtonsoft.Json.Tests.Linq
jsonWriter.WriteValue("DVD read/writer");
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
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 || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
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 || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
[Test]
public void WriteBigInteger()
{
@@ -28,7 +28,7 @@ using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using Newtonsoft.Json.Tests.TestObjects;
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
using System.Numerics;
#endif
using System.Text;
@@ -158,7 +158,7 @@ namespace Newtonsoft.Json.Tests.Linq
Assert.AreEqual(g, v.Value);
Assert.AreEqual(JTokenType.Guid, v.Type);
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
BigInteger i = BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990");
v.Value = i;
Assert.AreEqual(i, v.Value);
@@ -218,13 +218,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 || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
v = new JValue(BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990"));
Assert.AreEqual("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990", v.ToString(null, CultureInfo.InvariantCulture));
#endif
}
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
[Test]
public void JValueParse()
{
@@ -473,7 +473,7 @@ namespace Newtonsoft.Json.Tests.Linq
}
#endif
#if !(NETFX_CORE || PORTABLE || DNXCORE50)
#if !(NETFX_CORE || PORTABLE)
[Test]
public void ConvertsToBoolean()
{
@@ -492,7 +492,7 @@ namespace Newtonsoft.Json.Tests.Linq
Assert.AreEqual(Int32.MaxValue, Convert.ToInt32(new JValue(Int32.MaxValue)));
}
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
[Test]
public void ConvertsToInt32_BigInteger()
{
@@ -654,7 +654,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 || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
v = new JValue(new BigInteger(3));
Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
#endif
@@ -668,7 +668,7 @@ namespace Newtonsoft.Json.Tests.Linq
int i = (int)v.ToType(typeof(int), CultureInfo.InvariantCulture);
Assert.AreEqual(9, i);
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
BigInteger bi = (BigInteger)v.ToType(typeof(BigInteger), CultureInfo.InvariantCulture);
Assert.AreEqual(new BigInteger(9), bi);
#endif
@@ -683,7 +683,7 @@ namespace Newtonsoft.Json.Tests.Linq
Assert.AreEqual("2013", v.ToString("yyyy"));
}
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
[Test]
public void ToStringNewTypes()
{
@@ -1,402 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Newtonsoft.Json.Tests</RootNamespace>
<AssemblyName>Newtonsoft.Json.Tests</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>Newtonsoft.Json.Tests.WinRT_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>3116117C65F73A227A0BDC35F584F04145BA4BB7</PackageCertificateThumbprint>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\WinRT\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\WinRT\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<AppXPackage>True</AppXPackage>
</PropertyGroup>
<ItemGroup>
<!--A reference to the entire .Net Framework and Windows SDK are automatically included-->
<SDKReference Include="MSTestFramework, Version=11.0" />
<SDKReference Include="TestPlatform, Version=11.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="Bson\BsonReaderTests.cs" />
<Compile Include="Bson\BsonWriterTests.cs" />
<Compile Include="Converters\BinaryConverterTests.cs" />
<Compile Include="Converters\CustomCreationConverterTests.cs" />
<Compile Include="Converters\DataSetConverterTests.cs" />
<Compile Include="Converters\DataTableConverterTests.cs" />
<Compile Include="Converters\DiscriminatedUnionConverterTests.cs" />
<Compile Include="Converters\ExpandoObjectConverterTests.cs" />
<Compile Include="Converters\IsoDateTimeConverterTests.cs" />
<Compile Include="Converters\JavaScriptDateTimeConverterTests.cs" />
<Compile Include="Converters\JsonValueConverterTests.cs" />
<Compile Include="Converters\KeyValuePairConverterTests.cs" />
<Compile Include="Converters\ObjectIdConverterTests.cs" />
<Compile Include="Converters\RegexConverterTests.cs" />
<Compile Include="Converters\StringEnumConverterTests.cs" />
<Compile Include="Converters\VersionConverterTests.cs" />
<Compile Include="Converters\XmlNodeConverterTest.cs" />
<Compile Include="ExceptionTests.cs" />
<Compile Include="JsonArrayAttributeTests.cs" />
<Compile Include="JsonConvertTest.cs" />
<Compile Include="JsonTextReaderTest.cs" />
<Compile Include="JsonTextWriterTest.cs" />
<Compile Include="JsonValidatingReaderTests.cs" />
<Compile Include="Linq\ComponentModel\BindingTests.cs" />
<Compile Include="Linq\ComponentModel\JPropertyDescriptorTests.cs" />
<Compile Include="Linq\DynamicTests.cs" />
<Compile Include="Linq\JArrayTests.cs" />
<Compile Include="Linq\JConstructorTests.cs" />
<Compile Include="Linq\JObjectTests.cs" />
<Compile Include="Linq\JPropertyTests.cs" />
<Compile Include="Linq\JRawTests.cs" />
<Compile Include="Linq\JsonPath\JPathExecuteTests.cs" />
<Compile Include="Linq\JsonPath\JPathParseTests.cs" />
<Compile Include="Linq\JsonPath\QueryExpressionTests.cs" />
<Compile Include="Linq\JTokenEqualityComparerTests.cs" />
<Compile Include="Linq\JTokenReaderTest.cs" />
<Compile Include="Linq\JTokenTests.cs" />
<Compile Include="Linq\JTokenWriterTest.cs" />
<Compile Include="Linq\JValueTests.cs" />
<Compile Include="Linq\LinqToJsonTest.cs" />
<Compile Include="PerformanceTests.cs" />
<Compile Include="Schema\ExtensionsTests.cs" />
<Compile Include="Schema\JsonSchemaBuilderTests.cs" />
<Compile Include="Schema\JsonSchemaGeneratorTests.cs" />
<Compile Include="Schema\JsonSchemaModelBuilderTests.cs" />
<Compile Include="Schema\JsonSchemaNodeTests.cs" />
<Compile Include="Schema\JsonSchemaTests.cs" />
<Compile Include="Serialization\CamelCasePropertyNamesContractResolverTests.cs" />
<Compile Include="Serialization\ConstructorHandlingTests.cs" />
<Compile Include="Serialization\ContractResolverTests.cs" />
<Compile Include="Serialization\DefaultValueHandlingTests.cs" />
<Compile Include="Serialization\DependencyInjectionTests.cs" />
<Compile Include="Serialization\DynamicConcreteTests.cs" />
<Compile Include="Serialization\DynamicTests.cs" />
<Compile Include="Serialization\EntitiesSerializationTests.cs" />
<Compile Include="Serialization\ExtensionDataTests.cs" />
<Compile Include="Serialization\FSharpTests.cs" />
<Compile Include="Serialization\ImmutableCollectionsTests.cs" />
<Compile Include="Serialization\JsonPropertyCollectionTests.cs" />
<Compile Include="Serialization\JsonSerializerCollectionsTests.cs" />
<Compile Include="Serialization\JsonSerializerTest.cs" />
<Compile Include="Serialization\MissingMemberHandlingTests.cs" />
<Compile Include="Serialization\NullValueHandlingTests.cs" />
<Compile Include="Serialization\PopulateTests.cs" />
<Compile Include="Serialization\PreserveReferencesHandlingTests.cs" />
<Compile Include="Serialization\ReferenceLoopHandlingTests.cs" />
<Compile Include="Serialization\ReflectionAttributeProviderTests.cs" />
<Compile Include="Serialization\SerializationErrorHandlingTests.cs" />
<Compile Include="Serialization\SerializationEventAttributeTests.cs" />
<Compile Include="Serialization\ShouldSerializeTests.cs" />
<Compile Include="Serialization\MetadataPropertyHandlingTests.cs" />
<Compile Include="Serialization\TraceWriterTests.cs" />
<Compile Include="Serialization\TypeNameHandlingTests.cs" />
<Compile Include="Serialization\WebApiIntegrationTests.cs" />
<Compile Include="TestFixtureBase.cs" />
<Compile Include="TestObjects\Aa.cs" />
<Compile Include="TestObjects\AbstractGenericBase.cs" />
<Compile Include="TestObjects\AnswerFilterModel.cs" />
<Compile Include="TestObjects\Antworten.cs" />
<Compile Include="TestObjects\ArgumentConverterPrecedenceClassConverter.cs" />
<Compile Include="TestObjects\Article.cs" />
<Compile Include="TestObjects\ArticleCollection.cs" />
<Compile Include="TestObjects\BadJsonPropertyClass.cs" />
<Compile Include="TestObjects\Bar.cs" />
<Compile Include="TestObjects\Bb.cs" />
<Compile Include="TestObjects\Car.cs" />
<Compile Include="TestObjects\CircularReferenceClass.cs" />
<Compile Include="TestObjects\CircularReferenceWithIdClass.cs" />
<Compile Include="TestObjects\ClassAndMemberConverterClass.cs" />
<Compile Include="TestObjects\ClassConverterPrecedenceClassConverter.cs" />
<Compile Include="TestObjects\ClassWithArray.cs" />
<Compile Include="TestObjects\ClassWithGuid.cs" />
<Compile Include="TestObjects\Component.cs" />
<Compile Include="TestObjects\Computer.cs" />
<Compile Include="TestObjects\ConstructorCaseSensitivityClass.cs" />
<Compile Include="TestObjects\ConstructorReadonlyFields.cs" />
<Compile Include="TestObjects\Container.cs" />
<Compile Include="TestObjects\Content.cs" />
<Compile Include="TestObjects\ContentBaseClass.cs" />
<Compile Include="TestObjects\ContentSubClass.cs" />
<Compile Include="TestObjects\ConverableMembers.cs" />
<Compile Include="TestObjects\ConverterPrecedenceClass.cs" />
<Compile Include="TestObjects\ConverterPrecedenceClassConverter.cs" />
<Compile Include="TestObjects\Currency.cs" />
<Compile Include="TestObjects\CustomerDataSet.cs" />
<Compile Include="TestObjects\DataContractSerializationAttributesClass.cs" />
<Compile Include="TestObjects\DateTimeErrorObjectCollection.cs" />
<Compile Include="TestObjects\DateTimeTestClass.cs" />
<Compile Include="TestObjects\DateTimeWrapper.cs" />
<Compile Include="TestObjects\DecimalTestClass.cs" />
<Compile Include="TestObjects\DefaultValueAttributeTestClass.cs" />
<Compile Include="TestObjects\DictionaryInterfaceClass.cs" />
<Compile Include="TestObjects\DirectoryAccount.cs" />
<Compile Include="TestObjects\DoubleClass.cs" />
<Compile Include="TestObjects\EmployeeReference.cs" />
<Compile Include="TestObjects\Event.cs" />
<Compile Include="TestObjects\Event1.cs" />
<Compile Include="TestObjects\Foo.cs" />
<Compile Include="TestObjects\GameObject.cs" />
<Compile Include="TestObjects\GenericImpl.cs" />
<Compile Include="TestObjects\GenericListAndDictionaryInterfaceProperties.cs" />
<Compile Include="TestObjects\GetOnlyPropertyClass.cs" />
<Compile Include="TestObjects\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
<Compile Include="TestObjects\IdReferenceResolver.cs" />
<Compile Include="TestObjects\IMyInterface.cs" />
<Compile Include="TestObjects\IncompatibleJsonAttributeClass.cs" />
<Compile Include="TestObjects\InterfacePropertyTestClass.cs" />
<Compile Include="TestObjects\IntToFloatConverter.cs" />
<Compile Include="TestObjects\Invoice.cs" />
<Compile Include="TestObjects\IPrivateImplementationA.cs" />
<Compile Include="TestObjects\IPrivateImplementationB.cs" />
<Compile Include="TestObjects\IPrivateOverriddenImplementation.cs" />
<Compile Include="TestObjects\Item.cs" />
<Compile Include="TestObjects\JaggedArray.cs" />
<Compile Include="TestObjects\JsonIgnoreAttributeOnClassTestClass.cs" />
<Compile Include="TestObjects\JsonIgnoreAttributeTestClass.cs" />
<Compile Include="TestObjects\JsonPropertyClass.cs" />
<Compile Include="TestObjects\JsonPropertyWithHandlingValues.cs" />
<Compile Include="TestObjects\ListErrorObject.cs" />
<Compile Include="TestObjects\ListErrorObjectCollection.cs" />
<Compile Include="TestObjects\ListOfIds.cs" />
<Compile Include="TestObjects\ListTestClass.cs" />
<Compile Include="TestObjects\LogEntry.cs" />
<Compile Include="TestObjects\MemberConverterClass.cs" />
<Compile Include="TestObjects\MemberConverterPrecedenceClassConverter.cs" />
<Compile Include="TestObjects\MethodExecutorObject.cs" />
<Compile Include="TestObjects\MetroPropertyNameResolver.cs" />
<Compile Include="TestObjects\MetroStringConverter.cs" />
<Compile Include="TestObjects\Movie.cs" />
<Compile Include="TestObjects\MyClass.cs" />
<Compile Include="TestObjects\Name.cs" />
<Compile Include="TestObjects\NonRequest.cs" />
<Compile Include="TestObjects\NullableDateTimeTestClass.cs" />
<Compile Include="TestObjects\NullableGuid.cs" />
<Compile Include="TestObjects\ObjectArrayPropertyTest.cs" />
<Compile Include="TestObjects\ParticipantEntity.cs" />
<Compile Include="TestObjects\Person.cs" />
<Compile Include="TestObjects\PersonError.cs" />
<Compile Include="TestObjects\PersonPropertyClass.cs" />
<Compile Include="TestObjects\PersonRaw.cs" />
<Compile Include="TestObjects\PersonReference.cs" />
<Compile Include="TestObjects\PersonSerializable.cs" />
<Compile Include="TestObjects\PersonWithPrivateConstructor.cs" />
<Compile Include="TestObjects\PhoneNumber.cs" />
<Compile Include="TestObjects\PocoDataContractSerializationAttributesClass.cs" />
<Compile Include="TestObjects\PrivateConstructorTestClass.cs" />
<Compile Include="TestObjects\PrivateConstructorWithPublicParametizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PrivateImplementationAClass.cs" />
<Compile Include="TestObjects\PrivateImplementationBClass.cs" />
<Compile Include="TestObjects\PrivateMembersClass.cs" />
<Compile Include="TestObjects\Product.cs" />
<Compile Include="TestObjects\ProductCollection.cs" />
<Compile Include="TestObjects\ProductShort.cs" />
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\PropertyItemConverter.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorRequiringConverterTestClass.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorWithNonPropertyParameterTestClass.cs" />
<Compile Include="TestObjects\PublicParametizedConstructorWithPropertyNameConflict.cs" />
<Compile Include="TestObjects\Ratio.cs" />
<Compile Include="TestObjects\RequestOnly.cs" />
<Compile Include="TestObjects\RequiredMembersClass.cs" />
<Compile Include="TestObjects\RequiredObject.cs" />
<Compile Include="TestObjects\RoleTransfer.cs" />
<Compile Include="TestObjects\SearchResult.cs" />
<Compile Include="TestObjects\SelectListItem.cs" />
<Compile Include="TestObjects\SerializationEventTestDictionary.cs" />
<Compile Include="TestObjects\SerializationEventTestList.cs" />
<Compile Include="TestObjects\SerializationEventTestObject.cs" />
<Compile Include="TestObjects\SerializationEventTestObjectWithConstructor.cs" />
<Compile Include="TestObjects\SetOnlyPropertyClass.cs" />
<Compile Include="TestObjects\SetOnlyPropertyClass2.cs" />
<Compile Include="TestObjects\Shape.cs" />
<Compile Include="TestObjects\Shortie.cs" />
<Compile Include="TestObjects\Store.cs" />
<Compile Include="TestObjects\StoreColor.cs" />
<Compile Include="TestObjects\StructTest.cs" />
<Compile Include="TestObjects\SubKlass.cs" />
<Compile Include="TestObjects\SuperKlass.cs" />
<Compile Include="TestObjects\TestComponent.cs" />
<Compile Include="TestObjects\TestComponentSimple.cs" />
<Compile Include="TestObjects\TestObject.cs" />
<Compile Include="TestObjects\TypeClass.cs" />
<Compile Include="TestObjects\TypedSubHashtable.cs" />
<Compile Include="TestObjects\UriGuidTimeSpanTestClass.cs" />
<Compile Include="TestObjects\UserNullable.cs" />
<Compile Include="TestObjects\VersionKeyedCollection.cs" />
<Compile Include="TestObjects\WagePerson.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestObjects\Widget.cs" />
<Compile Include="TestObjects\Widget1.cs" />
<Compile Include="TestObjects\WidgetId.cs" />
<Compile Include="TestObjects\WidgetId1.cs" />
<Compile Include="TestObjects\WidgetIdJsonConverter.cs" />
<Compile Include="TestObjects\WithEnums.cs" />
<Compile Include="Utilities\DateTimeUtilsTests.cs" />
<Compile Include="Utilities\DynamicReflectionDelegateFactoryTests.cs" />
<Compile Include="Utilities\ExpressionReflectionDelegateFactoryTests.cs" />
<Compile Include="Utilities\LateboundReflectionDelegateFactoryTests.cs" />
<Compile Include="Utilities\ReflectionUtilsTests.cs" />
<Compile Include="Utilities\StringUtilsTests.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="bunny_pancake.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\UnitTestLogo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\UnitTestSmallLogo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\UnitTestSplashScreen.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\UnitTestStoreLogo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="large_sample.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="PoisonText.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Newtonsoft.Json\Newtonsoft.Json.WinRT.csproj">
<Project>{263136a2-b89b-424e-a87a-f988caa8d032}</Project>
<Name>Newtonsoft.Json.WinRT</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="large.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Newtonsoft.Json.Tests.WinRT_TemporaryKey.pfx" />
<Content Include="SpaceShipV2.bson">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Reference Include="System.Collections.Immutable">
<HintPath>..\packages\System.Collections.Immutable.1.1.33-beta\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' ">
<VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="A8B0D936-59D4-42B2-8044-E3920F5398BD" Publisher="CN=James" Version="1.0.0.0" />
<Properties>
<DisplayName>Newtonsoft.Json.Tests.WinRT</DisplayName>
<PublisherDisplayName>James</PublisherDisplayName>
<Logo>Images\UnitTestStoreLogo.png</Logo>
<Description>Newtonsoft.Json.Tests.WinRT</Description>
</Properties>
<Prerequisites>
<OSMinVersion>6.2</OSMinVersion>
<OSMaxVersionTested>6.2</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="vstest.executionengine.App" Executable="vstest.executionengine.appcontainer.exe" EntryPoint="vstest.executionengine.App">
<VisualElements DisplayName="NoUIEntryPoints" Logo="Images\UnitTestLogo.png" SmallLogo="Images\UnitTestSmallLogo.png" Description="vstest.executionengine.App" ForegroundText="light" BackgroundColor="#0084FF">
<SplashScreen Image="Images\UnitTestSplashScreen.png" />
</VisualElements>
</Application>
<Application Id="vstest.executionengine.x86.App" Executable="vstest.executionengine.appcontainer.x86.exe" EntryPoint="vstest.executionengine.x86.App">
<VisualElements DisplayName="NoUIEntryPoints" Logo="Images\UnitTestLogo.png" SmallLogo="Images\UnitTestSmallLogo.png" Description="vstest.executionengine.x86.App" ForegroundText="light" BackgroundColor="#0084FF">
<SplashScreen Image="Images\UnitTestSplashScreen.png" />
</VisualElements>
</Application>
</Applications>
</Package>
@@ -76,4 +76,4 @@ using System.Security;
// by using the '*' as shown below:
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.1.18621")]
[assembly: AssemblyFileVersion("7.0.2.18802")]
@@ -32,7 +32,17 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Schema;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Schema
{
@@ -105,7 +105,7 @@ namespace Newtonsoft.Json.Tests.Serialization
string json = o.ToString();
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#pragma warning disable 618
[Test]
public void MemberSearchFlags()
@@ -49,6 +49,7 @@ using Newtonsoft.Json.Tests.TestObjects;
using System.Reflection;
using Newtonsoft.Json.Utilities;
using System.Globalization;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Serialization
{
@@ -565,7 +566,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}", startingWithB);
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#pragma warning disable 618
[Test]
public void SerializeCompilerGeneratedMembers()
@@ -602,14 +603,12 @@ namespace Newtonsoft.Json.Tests.Serialization
string includeCompilerGeneratedJson = JsonConvert.SerializeObject(structTest, Formatting.Indented,
new JsonSerializerSettings { ContractResolver = includeCompilerGeneratedResolver });
StringAssert.AreEqual(@"{
""StringField"": ""Field"",
""IntField"": 1,
""<StringProperty>k__BackingField"": ""Property"",
""<IntProperty>k__BackingField"": 2,
""StringProperty"": ""Property"",
""IntProperty"": 2
}", includeCompilerGeneratedJson);
JObject o = JObject.Parse(includeCompilerGeneratedJson);
Console.WriteLine(includeCompilerGeneratedJson);
Assert.AreEqual("Property", (string)o["<StringProperty>k__BackingField"]);
Assert.AreEqual(2, (int)o["<IntProperty>k__BackingField"]);
}
#pragma warning restore 618
#endif
@@ -27,7 +27,7 @@ using System;
using System.Collections;
using System.Collections.Specialized;
using System.Runtime.Serialization;
#if !(NET35 || NET20 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
using System.Collections.Concurrent;
#endif
using System.Collections.Generic;
@@ -59,7 +59,7 @@ namespace Newtonsoft.Json.Tests.Serialization
[TestFixture]
public class JsonSerializerCollectionsTests : TestFixtureBase
{
#if !NETFX_CORE
#if !(NETFX_CORE || DNXCORE50)
public class NameValueCollectionTestClass
{
public NameValueCollection Collection { get; set; }
@@ -715,7 +715,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(3, v2["Third"]);
}
#if !(NET35 || NET20 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
[Test]
public void DeserializeConcurrentDictionary()
{
@@ -1659,6 +1659,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}
#endif
#if !DNXCORE50
[Test]
public void EmptyStringInHashtableIsDeserialized()
{
@@ -1671,6 +1672,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(deserializeTest2["testkey"], "");
}
#endif
}
#if !(NET40 || NET35 || NET20 || PORTABLE40)
@@ -29,7 +29,7 @@ using System.ComponentModel;
using System.Collections.Concurrent;
#endif
using System.Collections.Generic;
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE)
using System.Numerics;
#endif
#if !(NET20 || NETFX_CORE || DNXCORE50)
@@ -59,6 +59,7 @@ using System.Collections;
using System.Xml;
using System.Xml.Serialization;
using System.Collections.ObjectModel;
using System.Diagnostics;
using Newtonsoft.Json.Bson;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
@@ -87,7 +88,6 @@ using System.Linq;
#endif
#if !(NETFX_CORE || DNXCORE50)
using System.Drawing;
using System.Diagnostics;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -158,7 +158,11 @@ namespace Newtonsoft.Json.Tests.Serialization
protected override string ResolvePropertyName(string propertyName)
{
#if DNXCORE50
return propertyName.ToUpperInvariant();
#else
return propertyName.ToUpper(CultureInfo.InvariantCulture);
#endif
}
}
@@ -566,7 +570,7 @@ namespace Newtonsoft.Json.Tests.Serialization
public int ChildId;
}
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
[Test]
public void ReadIntegerWithError()
{
@@ -1356,7 +1360,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual("value", deserialized.foo.bar);
}
#if !(NETFX_CORE || DNXCORE50)
#if !(NETFX_CORE)
[Test]
public void ConversionOperator()
{
@@ -1442,7 +1446,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}
// ignore hiding members compiler warning
#pragma warning disable 108,114
#pragma warning disable 108, 114
[DataContract]
public class BaseWithContract
{
@@ -1520,7 +1524,7 @@ namespace Newtonsoft.Json.Tests.Serialization
[DataMember(Name = "VirtualWithDataMemberSub")]
public virtual string VirtualWithDataMember { get; set; }
}
#pragma warning restore 108,114
#pragma warning restore 108, 114
[Test]
public void SubWithoutContractNewPropertiesTest()
@@ -4752,7 +4756,7 @@ Path '', line 1, position 1.");
}", json);
}
#if !(PORTABLE || DNXCORE50)
#if !(PORTABLE)
[Test]
public void DeserializeClassWithInheritedProtectedMember()
{
@@ -6670,7 +6674,7 @@ Path '', line 1, position 1.");
ExceptionAssert.Throws<JsonSerializationException>(() => { List<int> numbers = JsonConvert.DeserializeObject<List<int>>(json); }, "Error converting value {null} to type 'System.Int32'. Path '[3]', line 5, position 7.");
}
#if !(PORTABLE || DNXCORE50 || NETFX_CORE)
#if !(PORTABLE || NETFX_CORE)
public class ConvertableIntTestClass
{
public ConvertibleInt Integer { get; set; }
@@ -7736,7 +7740,7 @@ Path '', line 1, position 1.");
}
#if !(NET20 || NET35 || NET40 || PORTABLE40)
#if !(PORTABLE || DNXCORE50)
#if !PORTABLE
[Test]
public void DeserializeReadOnlyListWithBigInteger()
{
@@ -7825,7 +7829,7 @@ Path '', line 1, position 1.");
}
#endif
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || NET35 || NET20 || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || NET35 || NET20 || PORTABLE40 || DNXCORE50)
[Test]
public void SerializeTupleWithSerializableAttribute()
{
@@ -8071,7 +8075,7 @@ Path '', line 1, position 1.");
}
#endif
#if !(PORTABLE || DNXCORE50 || NET35 || NET20 || PORTABLE40)
#if !(PORTABLE || NET35 || NET20 || PORTABLE40)
[Test]
public void ReadTooLargeInteger()
{
@@ -8254,7 +8258,7 @@ Path '', line 1, position 1.");
}
#endif
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
[Test]
public void SerializeBigInteger()
{
@@ -8432,7 +8436,7 @@ Path '', line 1, position 1.");
Assert.AreEqual(jane, john.Spouse);
}
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || PORTABLE40)
[Test]
public void TypeConverterOnInterface()
{
@@ -8498,7 +8502,7 @@ Path '', line 1, position 1.");
ParticipantEntity deserializedProduct = JsonConvert.DeserializeObject<ParticipantEntity>(json);
}
#if !(PORTABLE || DNXCORE50 || NETFX_CORE)
#if !(PORTABLE || NETFX_CORE)
public class ConvertibleId : IConvertible
{
public int Value;
@@ -9000,7 +9004,7 @@ Path '', line 1, position 1.");
}
#endif
#if !NETFX_CORE
#if !(NETFX_CORE || DNXCORE50)
[Test]
public void MailMessageConverterTest()
{
@@ -4,7 +4,7 @@ using System.Diagnostics;
using System.Globalization;
using System.IO;
using Newtonsoft.Json.Linq;
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE ||PORTABLE40)
using System.Numerics;
#endif
using System.Runtime.Serialization;
@@ -810,7 +810,7 @@ Newtonsoft.Json Error: 0 : Error!
Assert.AreEqual(23, deserialized.FavoriteNumber);
}
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
[Test]
public void TraceJsonWriterTest()
{
+5 -1
View File
@@ -144,6 +144,10 @@ namespace Newtonsoft.Json.Tests
XAssert.True(false, message);
}
public static void Pass()
{
}
public static void IsTrue(bool condition, string message = null)
{
XAssert.True(condition);
@@ -261,7 +265,7 @@ namespace Newtonsoft.Json.Tests
protected void TestSetup()
#endif
{
#if !NETFX_CORE
#if !(NETFX_CORE || DNXCORE50)
//CultureInfo turkey = CultureInfo.CreateSpecificCulture("tr");
//Thread.CurrentThread.CurrentCulture = turkey;
//Thread.CurrentThread.CurrentUICulture = turkey;
@@ -28,15 +28,17 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Text;
using System.Reflection;
#if NET20
using Newtonsoft.Json.Utilities.LinqBridge;
#else
using System.Linq;
#endif
using Newtonsoft.Json.Utilities;
namespace Newtonsoft.Json.Tests.TestObjects
{
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || PORTABLE40)
[TypeConverter(typeof(MyInterfaceConverter))]
internal interface IMyInterface
{
@@ -121,9 +123,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
{
private TypeConverter GetConverter(Type type)
{
var converters = type.GetCustomAttributes(typeof(TypeConverterAttribute), true).Union(
var converters = ReflectionUtils.GetAttributes(type, typeof(TypeConverterAttribute), true).Union(
from t in type.GetInterfaces()
from c in t.GetCustomAttributes(typeof(TypeConverterAttribute), true)
from c in ReflectionUtils.GetAttributes(t, typeof(TypeConverterAttribute), true)
select c).Distinct();
return
@@ -136,7 +138,6 @@ namespace Newtonsoft.Json.Tests.TestObjects
.FirstOrDefault();
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var converter = GetConverter(value.GetType());
@@ -26,6 +26,7 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Utilities;
using System.Reflection;
namespace Newtonsoft.Json.Tests.TestObjects
{
@@ -66,20 +66,6 @@ namespace Newtonsoft.Json.Tests.Utilities
Assert.AreEqual(value, parsedDt);
}
[Test]
public void FailingDateTimeParse()
{
string text = "2000-12-15T22:11:03.055+23:30";
DateTime oldDt;
bool success = DateTime.TryParseExact(text, "yyyy-MM-ddTHH:mm:ss.FFFFFFFK", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out oldDt);
Console.WriteLine("Success: " + success);
Console.WriteLine("DateTime: " + oldDt);
Assert.IsTrue(success);
}
[Test]
public void NewDateTimeParse()
{
@@ -102,32 +88,24 @@ namespace Newtonsoft.Json.Tests.Utilities
AssertNewDateTimeParseEqual("2000-12-15T22:11:03.055Z");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03.055");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03.055+00:00");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03.055+23:30");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03.055-23:30");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03.055+11:30");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03.055-11:30");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03Z");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03+00:00");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03+23:30");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03-23:30");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03+11:30");
AssertNewDateTimeParseEqual("2000-12-15T22:11:03-11:30");
AssertNewDateTimeParseEqual("0001-01-01T00:00:00Z");
AssertNewDateTimeParseEqual("0001-01-01T00:00:00"); // this is DateTime.MinDate
//AssertNewDateTimeParseEqual("0001-01-01T00:00:00+00:00"); // when the timezone is negative then this breaks
//AssertNewDateTimeParseEqual("0001-01-01T00:00:00+23:30"); // I don't know why a different value is returned from DateTime.TryParse, I think it is a bug in .NET
AssertNewDateTimeParseEqual("0001-01-01T00:00:00-23:30");
//AssertNewDateTimeParseEqual("0001-01-01T00:00:00+11:30"); // when the timezone is negative then this breaks
AssertNewDateTimeParseEqual("0001-01-01T00:00:00-12:00");
AssertNewDateTimeParseEqual("9999-12-31T23:59:59.9999999Z");
AssertNewDateTimeParseEqual("9999-12-31T23:59:59.9999999"); // this is DateTime.MaxDate
AssertNewDateTimeParseEqual("9999-12-31T23:59:59.9999999+00:00", DateTime.MaxValue); // DateTime.TryParse fails instead of returning MaxDate in some timezones
AssertNewDateTimeParseEqual("9999-12-31T23:59:59.9999999+23:30");
AssertNewDateTimeParseEqual("9999-12-31T23:59:59.9999999-23:30", DateTime.MaxValue); // DateTime.TryParse fails instead of returning MaxDate in some timezones
AssertNewDateTimeParseEqual("9999-12-31T23:59:59.9999999+11:30", DateTime.MaxValue); // DateTime.TryParse fails instead of returning MaxDate in some timezones
AssertNewDateTimeParseEqual("9999-12-31T23:59:59.9999999-11:30", DateTime.MaxValue); // DateTime.TryParse fails instead of returning MaxDate in some timezones
}
+50 -49
View File
@@ -1,52 +1,53 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"define": []
},
"exclude":[
"LinqToSql",
"Documentation",
"FileSystemEntityModel.Designer.cs"
],
"dependencies": {
"Xunit.KRunner": "1.0.0-*",
"Newtonsoft.Json": "6.0.6"
},
"commands": {
"test": "Xunit.KRunner"
},
"frameworks": {
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.0-beta-*",
"System.Collections": "4.0.10-beta-*",
"System.ComponentModel.TypeConverter": "4.0.0-beta-*",
"System.Diagnostics.Debug": "4.0.10-beta-*",
"System.Dynamic.Runtime": "4.0.0-beta-*",
"System.Globalization": "4.0.10-beta-*",
"System.IO": "4.0.10-beta-*",
"System.Linq": "4.0.0-beta-*",
"System.Linq.Expressions": "4.0.0-beta-*",
"System.Reflection.Extensions": "4.0.0-beta-*",
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
"System.Runtime": "4.0.20-beta-*",
"System.Runtime.Extensions": "4.0.10-beta-*",
"System.Runtime.Serialization.Primitives": "4.0.0-beta-*",
"System.Runtime.Numerics": "4.0.0-beta-*",
"System.Runtime.Serialization.Json": "4.0.0-beta-*",
"System.Runtime.Serialization.Xml": "4.0.0-beta-*",
"System.Reflection.Emit.ILGeneration": "4.0.0-beta-*",
"System.Text.Encoding": "4.0.10-beta-*",
"System.Text.RegularExpressions": "4.0.0-beta-*",
"System.Text.Encoding.Extensions": "4.0.10-beta-*",
"System.Text.Encoding.CodePages": "4.0.0-beta-*",
"System.Threading": "4.0.0-beta-*",
"System.Xml.XDocument": "4.0.0-beta-*",
"System.Xml.XmlDocument": "4.0.0-beta-*",
"System.Xml.XmlSerializer": "4.0.0-beta-*",
"System.Xml.ReaderWriter": "4.0.10-beta-*",
"Microsoft.Bcl.Immutable": "1.1.20-beta"
}
}
"version": "1.0.0-*",
"compilationOptions": {
"define": [ ]
},
"exclude": [
"LinqToSql",
"Documentation",
"**/*.Designer.cs"
],
"dependencies": {
"xunit": "2.1.0-beta3-*",
"xunit.runner.dnx": "2.1.0-beta3-*",
"Newtonsoft.Json": "",
"System.Collections.Immutable": "1.1.37"
},
"commands": {
"test": "xunit.runner.dnx -parallel none"
},
"frameworks": {
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.0-beta-*",
"System.Collections": "4.0.10-beta-*",
"System.ComponentModel.TypeConverter": "4.0.0-beta-*",
"System.Diagnostics.Debug": "4.0.10-beta-*",
"System.Dynamic.Runtime": "4.0.10-beta-*",
"System.Globalization": "4.0.10-beta-*",
"System.IO": "4.0.10-beta-*",
"System.Linq": "4.0.0-beta-*",
"System.Linq.Expressions": "4.0.10-beta-*",
"System.Reflection.Extensions": "4.0.0-beta-*",
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
"System.Runtime": "4.0.20-beta-*",
"System.Runtime.Extensions": "4.0.10-beta-*",
"System.Runtime.Serialization.Primitives": "4.0.10-beta-*",
"System.Runtime.Numerics": "4.0.0-beta-*",
"System.Runtime.Serialization.Json": "4.0.0-beta-*",
"System.Runtime.Serialization.Xml": "4.0.10-beta-*",
"System.Reflection.Emit.ILGeneration": "4.0.0-beta-*",
"System.Text.Encoding": "4.0.10-beta-*",
"System.Text.RegularExpressions": "4.0.10-beta-*",
"System.Text.Encoding.Extensions": "4.0.10-beta-*",
"System.Text.Encoding.CodePages": "4.0.0-beta-*",
"System.Threading": "4.0.10-beta-*",
"System.Xml.XDocument": "4.0.10-beta-*",
"System.Xml.XmlDocument": "4.0.0-beta-*",
"System.Xml.XmlSerializer": "4.0.10-beta-*",
"System.Xml.ReaderWriter": "4.0.10-beta-*"
}
}
}
}
-65
View File
@@ -1,65 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30324.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.WinRT", "Newtonsoft.Json\Newtonsoft.Json.WinRT.csproj", "{263136A2-B89B-424E-A87A-F988CAA8D032}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Tests.WinRT", "Newtonsoft.Json.Tests\Newtonsoft.Json.Tests.WinRT.csproj", "{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|ARM.ActiveCfg = Debug|ARM
{263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|ARM.Build.0 = Debug|ARM
{263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|Any CPU.Build.0 = Debug|Any CPU
{263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|x64.ActiveCfg = Debug|x64
{263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|x64.Build.0 = Debug|x64
{263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|x86.ActiveCfg = Debug|x86
{263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|x86.Build.0 = Debug|x86
{263136A2-B89B-424E-A87A-F988CAA8D032}.Release|ARM.ActiveCfg = Release|ARM
{263136A2-B89B-424E-A87A-F988CAA8D032}.Release|ARM.Build.0 = Release|ARM
{263136A2-B89B-424E-A87A-F988CAA8D032}.Release|Any CPU.ActiveCfg = Release|Any CPU
{263136A2-B89B-424E-A87A-F988CAA8D032}.Release|Any CPU.Build.0 = Release|Any CPU
{263136A2-B89B-424E-A87A-F988CAA8D032}.Release|x64.ActiveCfg = Release|x64
{263136A2-B89B-424E-A87A-F988CAA8D032}.Release|x64.Build.0 = Release|x64
{263136A2-B89B-424E-A87A-F988CAA8D032}.Release|x86.ActiveCfg = Release|x86
{263136A2-B89B-424E-A87A-F988CAA8D032}.Release|x86.Build.0 = Release|x86
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|ARM.ActiveCfg = Debug|ARM
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|ARM.Build.0 = Debug|ARM
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|ARM.Deploy.0 = Debug|ARM
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x64.ActiveCfg = Debug|x64
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x64.Build.0 = Debug|x64
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x64.Deploy.0 = Debug|x64
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x86.ActiveCfg = Debug|x86
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x86.Build.0 = Debug|x86
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x86.Deploy.0 = Debug|x86
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|ARM.ActiveCfg = Release|ARM
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|ARM.Build.0 = Release|ARM
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|ARM.Deploy.0 = Release|ARM
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|Any CPU.Build.0 = Release|Any CPU
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|Any CPU.Deploy.0 = Release|Any CPU
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x64.ActiveCfg = Release|x64
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x64.Build.0 = Release|x64
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x64.Deploy.0 = Release|x64
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x86.ActiveCfg = Release|x86
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x86.Build.0 = Release|x86
{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json", "Newtonsoft.Json\Newtonsoft.Json.csproj", "{EEEA67F9-9089-481D-A4DC-0966DEC9FD7D}"
EndProject
+1 -1
View File
@@ -54,7 +54,7 @@ namespace Newtonsoft.Json.Bson
public void Close()
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
_writer.Close();
#else
_writer.Dispose();
+1 -1
View File
@@ -297,7 +297,7 @@ namespace Newtonsoft.Json.Bson
base.Close();
if (CloseInput && _reader != null)
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
_reader.Close();
#else
_reader.Dispose();
+1 -1
View File
@@ -379,7 +379,7 @@ namespace Newtonsoft.Json.Bson
{
base.WriteValue(value);
string s = null;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
s = value.ToString(CultureInfo.InvariantCulture);
#else
s = value.ToString();
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Data.SqlTypes;
using System.Globalization;
@@ -24,6 +24,7 @@
#endregion
using System;
using System.Reflection;
using Newtonsoft.Json.Utilities;
namespace Newtonsoft.Json.Converters
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Data;
using Newtonsoft.Json.Serialization;
@@ -23,10 +23,10 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json.Utilities;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
using System;
using System.Data;
using Newtonsoft.Json.Serialization;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
@@ -45,7 +45,7 @@ namespace Newtonsoft.Json.Converters
/// </summary>
public class DiscriminatedUnionConverter : JsonConverter
{
#region UnionDefinition
#region UnionDefinition
internal class Union
{
public List<UnionCase> Cases;
@@ -60,7 +60,7 @@ namespace Newtonsoft.Json.Converters
public FSharpFunction FieldReader;
public FSharpFunction Constructor;
}
#endregion
#endregion
private const string CasePropertyName = "Case";
private const string FieldsPropertyName = "Fields";
@@ -235,7 +235,7 @@ namespace Newtonsoft.Json.Converters
// all fsharp objects have CompilationMappingAttribute
// get the fsharp assembly from the attribute and initialize latebound methods
object[] attributes;
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
attributes = objectType.GetCustomAttributes(true);
#else
attributes = objectType.GetTypeInfo().GetCustomAttributes(true).ToArray();
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || DOTNET || PORTABLE40 || PORTABLE)
using System;
using Newtonsoft.Json.Serialization;
using System.Globalization;
@@ -31,6 +31,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Xml;
using System.Reflection;
#if !(NET20 || PORTABLE40)
using System.Xml.Linq;
#endif
@@ -44,7 +45,7 @@ using System.Linq;
namespace Newtonsoft.Json.Converters
{
#region XmlNodeWrappers
#if !NETFX_CORE && !PORTABLE && !PORTABLE40
#if !DOTNET && !PORTABLE && !PORTABLE40
internal class XmlDocumentWrapper : XmlNodeWrapper, IXmlDocument
{
private readonly XmlDocument _document;
@@ -928,7 +929,7 @@ namespace Newtonsoft.Json.Converters
if (value is XObject)
return XContainerWrapper.WrapNode((XObject)value);
#endif
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
if (value is XmlNode)
return XmlNodeWrapper.WrapNode((XmlNode)value);
#endif
@@ -1256,7 +1257,7 @@ namespace Newtonsoft.Json.Converters
rootNode = document;
}
#endif
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
if (typeof(XmlNode).IsAssignableFrom(objectType))
{
if (objectType != typeof(XmlDocument))
@@ -1448,7 +1449,7 @@ namespace Newtonsoft.Json.Converters
#endif
DateTime d = Convert.ToDateTime(reader.Value, CultureInfo.InvariantCulture);
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
return XmlConvert.ToString(d, DateTimeUtils.ToSerializationMode(d.Kind));
#else
return XmlConvert.ToString(d);
@@ -1780,7 +1781,7 @@ namespace Newtonsoft.Json.Converters
if (typeof(XObject).IsAssignableFrom(valueType))
return true;
#endif
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
if (typeof(XmlNode).IsAssignableFrom(valueType))
return true;
#endif
@@ -1,5 +1,5 @@

#if PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE
#if DOTNET || PORTABLE40 || PORTABLE
namespace System.Runtime.Serialization.Formatters
{
+3 -3
View File
@@ -357,7 +357,7 @@ namespace Newtonsoft.Json
{
string text;
string qc;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
text = value.ToString("D", CultureInfo.InvariantCulture);
qc = quoteChar.ToString(CultureInfo.InvariantCulture);
#else
@@ -481,7 +481,7 @@ namespace Newtonsoft.Json
return ToString((DateTime)value);
case PrimitiveTypeCode.Decimal:
return ToString((decimal)value);
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
case PrimitiveTypeCode.DBNull:
return Null;
#endif
@@ -969,7 +969,7 @@ namespace Newtonsoft.Json
}
#endif
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
/// <summary>
/// Serializes the XML node to a JSON string.
/// </summary>
+2 -2
View File
@@ -35,7 +35,7 @@ namespace Newtonsoft.Json
/// <summary>
/// The exception thrown when an error occurs during JSON serialization or deserialization.
/// </summary>
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
[Serializable]
#endif
public class JsonException : Exception
@@ -68,7 +68,7 @@ namespace Newtonsoft.Json
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonException"/> class.
/// </summary>
+2 -2
View File
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
/// <summary>
/// The exception thrown when an error occurs while reading JSON text.
/// </summary>
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
[Serializable]
#endif
public class JsonReaderException : JsonException
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonReaderException"/> class.
/// </summary>
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
/// <summary>
/// The exception thrown when an error occurs during JSON serialization or deserialization.
/// </summary>
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
[Serializable]
#endif
public class JsonSerializationException : JsonException
@@ -66,7 +66,7 @@ namespace Newtonsoft.Json
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonSerializationException"/> class.
/// </summary>
+3 -1
View File
@@ -1624,11 +1624,13 @@ namespace Newtonsoft.Json
base.Close();
if (CloseInput && _reader != null)
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
{
#if !(DOTNET || PORTABLE40 || PORTABLE)
_reader.Close();
#else
_reader.Dispose();
#endif
}
if (_buffer != null)
_buffer.Clear();
+4 -2
View File
@@ -152,11 +152,13 @@ namespace Newtonsoft.Json
base.Close();
if (CloseOutput && _writer != null)
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
{
#if !(DOTNET || PORTABLE40 || PORTABLE)
_writer.Close();
#else
_writer.Dispose();
#endif
}
}
/// <summary>
@@ -636,7 +638,7 @@ namespace Newtonsoft.Json
string text = null;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
text = value.ToString("D", CultureInfo.InvariantCulture);
#else
text = value.ToString("D");
+2 -2
View File
@@ -1396,13 +1396,13 @@ namespace Newtonsoft.Json
case PrimitiveTypeCode.Bytes:
writer.WriteValue((byte[])value);
break;
#if !(PORTABLE || NETFX_CORE)
#if !(PORTABLE || DOTNET)
case PrimitiveTypeCode.DBNull:
writer.WriteNull();
break;
#endif
default:
#if !(PORTABLE || NETFX_CORE)
#if !PORTABLE
if (value is IConvertible)
{
// the value is a non-standard IConvertible
+2 -2
View File
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
/// <summary>
/// The exception thrown when an error occurs while reading JSON text.
/// </summary>
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
[Serializable]
#endif
public class JsonWriterException : JsonException
@@ -72,7 +72,7 @@ namespace Newtonsoft.Json
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonWriterException"/> class.
/// </summary>
+10 -12
View File
@@ -46,17 +46,15 @@ namespace Newtonsoft.Json.Linq
/// Represents a token that can contain other tokens.
/// </summary>
public abstract class JContainer : JToken, IList<JToken>
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
, ITypedList, IBindingList
#elif PORTABLE
, INotifyCollectionChanged
#endif
, IList
#if !(NET20 || NET35 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || NET35 || PORTABLE40)
, INotifyCollectionChanged
#endif
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
internal ListChangedEventHandler _listChanged;
internal AddingNewEventHandler _addingNew;
@@ -132,7 +130,7 @@ namespace Newtonsoft.Json.Linq
return new List<JToken>();
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Raises the <see cref="AddingNew"/> event.
/// </summary>
@@ -376,7 +374,7 @@ namespace Newtonsoft.Json.Linq
ChildrenTokens.Insert(index, item);
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
#endif
@@ -410,7 +408,7 @@ namespace Newtonsoft.Json.Linq
ChildrenTokens.RemoveAt(index);
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
#endif
@@ -474,7 +472,7 @@ namespace Newtonsoft.Json.Linq
existing.Previous = null;
existing.Next = null;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
#endif
@@ -497,7 +495,7 @@ namespace Newtonsoft.Json.Linq
ChildrenTokens.Clear();
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
#endif
@@ -791,7 +789,7 @@ namespace Newtonsoft.Json.Linq
return hashCode;
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
string ITypedList.GetListName(PropertyDescriptor[] listAccessors)
{
return string.Empty;
@@ -960,7 +958,7 @@ namespace Newtonsoft.Json.Linq
#endregion
#region IBindingList Members
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
void IBindingList.AddIndex(PropertyDescriptor property)
{
}
+8 -8
View File
@@ -52,10 +52,10 @@ namespace Newtonsoft.Json.Linq
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParse" title="Parsing a JSON Object from Text" />
/// </example>
public class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
, ICustomTypeDescriptor
#endif
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || PORTABLE40 || PORTABLE)
, INotifyPropertyChanging
#endif
{
@@ -75,7 +75,7 @@ namespace Newtonsoft.Json.Linq
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
#if !(NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NET20 || PORTABLE || PORTABLE40)
/// <summary>
/// Occurs when a property value is changing.
/// </summary>
@@ -192,7 +192,7 @@ namespace Newtonsoft.Json.Linq
internal void InternalPropertyChanged(JProperty childProperty)
{
OnPropertyChanged(childProperty.Name);
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, IndexOfItem(childProperty)));
#endif
@@ -204,7 +204,7 @@ namespace Newtonsoft.Json.Linq
internal void InternalPropertyChanging(JProperty childProperty)
{
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || PORTABLE40 || PORTABLE)
OnPropertyChanging(childProperty.Name);
#endif
}
@@ -307,7 +307,7 @@ namespace Newtonsoft.Json.Linq
}
else
{
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || PORTABLE40 || PORTABLE)
OnPropertyChanging(propertyName);
#endif
Add(new JProperty(propertyName, value));
@@ -618,7 +618,7 @@ namespace Newtonsoft.Json.Linq
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE || NET20)
#if !(PORTABLE40 || PORTABLE || NET20)
/// <summary>
/// Raises the <see cref="PropertyChanging"/> event with the provided arguments.
/// </summary>
@@ -630,7 +630,7 @@ namespace Newtonsoft.Json.Linq
}
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
// include custom type descriptor on JObject rather than use a provider because the properties are specific to a type
#region ICustomTypeDescriptor
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System;
using System.ComponentModel;
+2 -2
View File
@@ -52,7 +52,7 @@ namespace Newtonsoft.Json.Linq
/// Represents an abstract JSON token.
/// </summary>
public abstract class JToken : IJEnumerable<JToken>, IJsonLineInfo
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
, ICloneable
#endif
#if !(NET35 || NET20 || PORTABLE40)
@@ -2069,7 +2069,7 @@ namespace Newtonsoft.Json.Linq
}
#endif
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
object ICloneable.Clone()
{
return DeepClone();
+1 -1
View File
@@ -365,7 +365,7 @@ namespace Newtonsoft.Json.Linq
{
base.WriteValue(value);
string s = null;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
s = value.ToString(CultureInfo.InvariantCulture);
#else
s = value.ToString();
+10 -5
View File
@@ -42,7 +42,7 @@ namespace Newtonsoft.Json.Linq
/// Represents a value in JSON (string, integer, date, etc).
/// </summary>
public class JValue : JToken, IEquatable<JValue>, IFormattable, IComparable, IComparable<JValue>
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
, IConvertible
#endif
{
@@ -563,7 +563,7 @@ namespace Newtonsoft.Json.Linq
{
if (value == null)
return JTokenType.Null;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
else if (value == DBNull.Value)
return JTokenType.Null;
#endif
@@ -965,7 +965,7 @@ namespace Newtonsoft.Json.Linq
return Compare(_valueType, _value, obj._value);
}
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
TypeCode IConvertible.GetTypeCode()
{
if (_value == null)
@@ -980,7 +980,12 @@ namespace Newtonsoft.Json.Linq
return TypeCode.Object;
#endif
return System.Type.GetTypeCode(_value.GetType());
IConvertible convertable = _value as IConvertible;
if (convertable == null)
return TypeCode.Object;
return convertable.GetTypeCode();
}
bool IConvertible.ToBoolean(IFormatProvider provider)
@@ -1058,5 +1063,5 @@ namespace Newtonsoft.Json.Linq
return ToObject(conversionType);
}
#endif
}
}
}
@@ -1,320 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{263136A2-B89B-424E-A87A-F988CAA8D032}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Newtonsoft.Json</RootNamespace>
<AssemblyName>Newtonsoft.Json</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\WinRT\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>3</WarningLevel>
<CodeAnalysisRuleSet>Newtonsoft.Json.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\WinRT\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\WinRT\Newtonsoft.Json.xml</DocumentationFile>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>Newtonsoft.Json.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
</ItemGroup>
<ItemGroup>
<Compile Include="Bson\BsonBinaryType.cs" />
<Compile Include="Bson\BsonBinaryWriter.cs" />
<Compile Include="Bson\BsonObjectId.cs" />
<Compile Include="Bson\BsonReader.cs" />
<Compile Include="Bson\BsonToken.cs" />
<Compile Include="Bson\BsonType.cs" />
<Compile Include="Bson\BsonWriter.cs" />
<Compile Include="ConstructorHandling.cs" />
<Compile Include="Converters\BinaryConverter.cs" />
<Compile Include="Converters\BsonObjectIdConverter.cs" />
<Compile Include="Converters\CustomCreationConverter.cs" />
<Compile Include="Converters\DataSetConverter.cs" />
<Compile Include="Converters\DataTableConverter.cs" />
<Compile Include="Converters\DateTimeConverterBase.cs" />
<Compile Include="Converters\DiscriminatedUnionConverter.cs" />
<Compile Include="Converters\EntityKeyMemberConverter.cs" />
<Compile Include="Converters\ExpandoObjectConverter.cs" />
<Compile Include="Converters\IsoDateTimeConverter.cs" />
<Compile Include="Converters\JavaScriptDateTimeConverter.cs" />
<Compile Include="Converters\JsonValueConverter.cs" />
<Compile Include="Converters\KeyValuePairConverter.cs" />
<Compile Include="Converters\RegexConverter.cs" />
<Compile Include="Converters\StringEnumConverter.cs" />
<Compile Include="Converters\VersionConverter.cs" />
<Compile Include="Converters\XmlNodeConverter.cs" />
<Compile Include="DateFormatHandling.cs" />
<Compile Include="DateParseHandling.cs" />
<Compile Include="DateTimeZoneHandling.cs" />
<Compile Include="FloatFormatHandling.cs" />
<Compile Include="DefaultValueHandling.cs" />
<Compile Include="FloatParseHandling.cs" />
<Compile Include="FormatterAssemblyStyle.cs" />
<Compile Include="Formatting.cs" />
<Compile Include="IJsonLineInfo.cs" />
<Compile Include="JsonArrayAttribute.cs" />
<Compile Include="JsonConstructorAttribute.cs" />
<Compile Include="JsonContainerAttribute.cs" />
<Compile Include="JsonConvert.cs" />
<Compile Include="JsonConverter.cs" />
<Compile Include="JsonConverterAttribute.cs" />
<Compile Include="JsonConverterCollection.cs" />
<Compile Include="JsonDictionaryAttribute.cs" />
<Compile Include="JsonException.cs" />
<Compile Include="JsonExtensionDataAttribute.cs" />
<Compile Include="JsonIgnoreAttribute.cs" />
<Compile Include="JsonObjectAttribute.cs" />
<Compile Include="JsonPosition.cs" />
<Compile Include="JsonPropertyAttribute.cs" />
<Compile Include="JsonReader.cs" />
<Compile Include="JsonReaderException.cs" />
<Compile Include="JsonSerializationException.cs" />
<Compile Include="JsonSerializer.cs" />
<Compile Include="JsonSerializerSettings.cs" />
<Compile Include="JsonTextReader.cs" />
<Compile Include="JsonTextWriter.cs" />
<Compile Include="JsonToken.cs" />
<Compile Include="JsonValidatingReader.cs" />
<Compile Include="JsonWriter.cs" />
<Compile Include="JsonWriterException.cs" />
<Compile Include="Linq\Extensions.cs" />
<Compile Include="Linq\IJEnumerable.cs" />
<Compile Include="Linq\JArray.cs" />
<Compile Include="Linq\JConstructor.cs" />
<Compile Include="Linq\JContainer.cs" />
<Compile Include="Linq\JEnumerable.cs" />
<Compile Include="Linq\JObject.cs" />
<Compile Include="Linq\JProperty.cs" />
<Compile Include="Linq\JPropertyDescriptor.cs" />
<Compile Include="Linq\JPropertyKeyedCollection.cs" />
<Compile Include="Linq\JRaw.cs" />
<Compile Include="Linq\JsonMergeSettings.cs" />
<Compile Include="Linq\JsonPath\ArrayIndexFilter.cs" />
<Compile Include="Linq\JsonPath\ArrayMultipleIndexFilter.cs" />
<Compile Include="Linq\JsonPath\ArraySliceFilter.cs" />
<Compile Include="Linq\JsonPath\FieldFilter.cs" />
<Compile Include="Linq\JsonPath\FieldMultipleFilter.cs" />
<Compile Include="Linq\JsonPath\JPath.cs" />
<Compile Include="Linq\JsonPath\PathFilter.cs" />
<Compile Include="Linq\JsonPath\QueryExpression.cs" />
<Compile Include="Linq\JsonPath\QueryFilter.cs" />
<Compile Include="Linq\JsonPath\ScanFilter.cs" />
<Compile Include="Linq\JToken.cs" />
<Compile Include="Linq\JTokenEqualityComparer.cs" />
<Compile Include="Linq\JTokenReader.cs" />
<Compile Include="Linq\JTokenType.cs" />
<Compile Include="Linq\JTokenWriter.cs" />
<Compile Include="Linq\JValue.cs" />
<Compile Include="Linq\MergeArrayHandling.cs" />
<Compile Include="MemberSerialization.cs" />
<Compile Include="MissingMemberHandling.cs" />
<Compile Include="NullValueHandling.cs" />
<Compile Include="ObjectCreationHandling.cs" />
<Compile Include="PreserveReferencesHandling.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReferenceLoopHandling.cs" />
<Compile Include="Required.cs" />
<Compile Include="Schema\Extensions.cs" />
<Compile Include="Schema\JsonSchema.cs" />
<Compile Include="Schema\JsonSchemaBuilder.cs" />
<Compile Include="Schema\JsonSchemaConstants.cs" />
<Compile Include="Schema\JsonSchemaException.cs" />
<Compile Include="Schema\JsonSchemaGenerator.cs" />
<Compile Include="Schema\JsonSchemaModel.cs" />
<Compile Include="Schema\JsonSchemaModelBuilder.cs" />
<Compile Include="Schema\JsonSchemaNode.cs" />
<Compile Include="Schema\JsonSchemaNodeCollection.cs" />
<Compile Include="Schema\JsonSchemaResolver.cs" />
<Compile Include="Schema\JsonSchemaType.cs" />
<Compile Include="Schema\JsonSchemaWriter.cs" />
<Compile Include="Schema\UndefinedSchemaIdHandling.cs" />
<Compile Include="Schema\ValidationEventArgs.cs" />
<Compile Include="Schema\ValidationEventHandler.cs" />
<Compile Include="SerializationBinder.cs" />
<Compile Include="Serialization\CachedAttributeGetter.cs" />
<Compile Include="Serialization\CamelCasePropertyNamesContractResolver.cs" />
<Compile Include="Serialization\DefaultContractResolver.cs" />
<Compile Include="Serialization\DefaultReferenceResolver.cs" />
<Compile Include="Serialization\DefaultSerializationBinder.cs" />
<Compile Include="Serialization\DynamicValueProvider.cs" />
<Compile Include="Serialization\ErrorContext.cs" />
<Compile Include="Serialization\ErrorEventArgs.cs" />
<Compile Include="Serialization\ExpressionValueProvider.cs" />
<Compile Include="Serialization\IAttributeProvider.cs" />
<Compile Include="Serialization\IContractResolver.cs" />
<Compile Include="Serialization\IReferenceResolver.cs" />
<Compile Include="Serialization\ITraceWriter.cs" />
<Compile Include="Serialization\IValueProvider.cs" />
<Compile Include="Serialization\JsonArrayContract.cs" />
<Compile Include="Serialization\JsonContainerContract.cs" />
<Compile Include="Serialization\JsonContract.cs" />
<Compile Include="Serialization\JsonDictionaryContract.cs" />
<Compile Include="Serialization\JsonDynamicContract.cs" />
<Compile Include="Serialization\JsonFormatterConverter.cs" />
<Compile Include="Serialization\JsonISerializableContract.cs" />
<Compile Include="Serialization\JsonLinqContract.cs" />
<Compile Include="Serialization\JsonObjectContract.cs" />
<Compile Include="Serialization\JsonPrimitiveContract.cs" />
<Compile Include="Serialization\JsonProperty.cs" />
<Compile Include="Serialization\JsonPropertyCollection.cs" />
<Compile Include="Serialization\JsonSerializerInternalBase.cs" />
<Compile Include="Serialization\JsonSerializerInternalReader.cs" />
<Compile Include="Serialization\JsonSerializerInternalWriter.cs" />
<Compile Include="Serialization\JsonSerializerProxy.cs" />
<Compile Include="Serialization\JsonStringContract.cs" />
<Compile Include="Serialization\JsonTypeReflector.cs" />
<Compile Include="Serialization\ObjectConstructor.cs" />
<Compile Include="Serialization\OnErrorAttribute.cs" />
<Compile Include="Serialization\ReflectionAttributeProvider.cs" />
<Compile Include="Serialization\ReflectionValueProvider.cs" />
<Compile Include="Serialization\DiagnosticsTraceWriter.cs" />
<Compile Include="Serialization\MemoryTraceWriter.cs" />
<Compile Include="Serialization\TraceJsonReader.cs" />
<Compile Include="Serialization\TraceJsonWriter.cs" />
<Compile Include="MetadataPropertyHandling.cs" />
<Compile Include="StringEscapeHandling.cs" />
<Compile Include="TraceLevel.cs" />
<Compile Include="TypeNameHandling.cs" />
<Compile Include="Utilities\Base64Encoder.cs" />
<Compile Include="Utilities\BidirectionalDictionary.cs" />
<Compile Include="Utilities\CollectionUtils.cs" />
<Compile Include="Utilities\CollectionWrapper.cs" />
<Compile Include="Utilities\ConvertUtils.cs" />
<Compile Include="Utilities\DateTimeParser.cs" />
<Compile Include="Utilities\DateTimeUtils.cs" />
<Compile Include="Utilities\DictionaryWrapper.cs" />
<Compile Include="Utilities\DynamicProxy.cs" />
<Compile Include="Utilities\DynamicProxyMetaObject.cs" />
<Compile Include="Utilities\DynamicReflectionDelegateFactory.cs" />
<Compile Include="Utilities\DynamicUtils.cs" />
<Compile Include="Utilities\EnumUtils.cs" />
<Compile Include="Utilities\EnumValue.cs" />
<Compile Include="Utilities\ExpressionReflectionDelegateFactory.cs" />
<Compile Include="Utilities\ILGeneratorExtensions.cs" />
<Compile Include="Utilities\ImmutableCollectionsUtils.cs" />
<Compile Include="Utilities\JavaScriptUtils.cs" />
<Compile Include="Utilities\JsonTokenUtils.cs" />
<Compile Include="Utilities\LateBoundReflectionDelegateFactory.cs" />
<Compile Include="Utilities\LinqBridge.cs" />
<Compile Include="Utilities\MathUtils.cs" />
<Compile Include="Utilities\MethodCall.cs" />
<Compile Include="Utilities\MiscellaneousUtils.cs" />
<Compile Include="Utilities\PropertyNameTable.cs" />
<Compile Include="Utilities\ReflectionDelegateFactory.cs" />
<Compile Include="Utilities\ReflectionObject.cs" />
<Compile Include="Utilities\ReflectionUtils.cs" />
<Compile Include="Utilities\StringBuffer.cs" />
<Compile Include="Utilities\StringReference.cs" />
<Compile Include="Utilities\StringUtils.cs" />
<Compile Include="Utilities\ThreadSafeStore.cs" />
<Compile Include="Utilities\TypeExtensions.cs" />
<Compile Include="Utilities\ValidationUtils.cs" />
<Compile Include="WriteState.cs" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' ">
<VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -36,8 +36,8 @@ using System.Security;
[assembly: AssemblyTitle("Json.NET Portable .NET 4.0")]
#elif PORTABLE
[assembly: AssemblyTitle("Json.NET Portable")]
#elif NETFX_CORE
[assembly: AssemblyTitle("Json.NET WinRT")]
#elif DOTNET
[assembly: AssemblyTitle("Json.NET .NET Platform")]
#elif NET20
[assembly: AssemblyTitle("Json.NET .NET 2.0")]
[assembly: AllowPartiallyTrustedCallers]
@@ -92,5 +92,5 @@ using System.Security;
// by using the '*' as shown below:
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.1.18621")]
[assembly: AssemblyFileVersion("7.0.2.18802")]
[assembly: CLSCompliant(true)]
@@ -36,7 +36,7 @@ namespace Newtonsoft.Json.Schema
/// JSON Schema validation has been moved to its own package. See <see href="http://www.newtonsoft.com/jsonschema">http://www.newtonsoft.com/jsonschema</see> for more details.
/// </note>
/// </summary>
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
[Serializable]
#endif
[Obsolete("JSON Schema validation has been moved to its own package. See http://www.newtonsoft.com/jsonschema for more details.")]
@@ -89,7 +89,7 @@ namespace Newtonsoft.Json.Schema
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonSchemaException"/> class.
/// </summary>
@@ -187,7 +187,7 @@ namespace Newtonsoft.Json.Schema
if (containerAttribute != null && !string.IsNullOrEmpty(containerAttribute.Description))
return containerAttribute.Description;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute<DescriptionAttribute>(type);
if (descriptionAttribute != null)
return descriptionAttribute.Description;
@@ -335,7 +335,7 @@ namespace Newtonsoft.Json.Schema
}
}
break;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
case JsonContractType.Serializable:
CurrentSchema.Type = AddNullType(JsonSchemaType.Object, valueRequired);
CurrentSchema.Id = GetTypeId(type, false);
@@ -394,7 +394,7 @@ namespace Newtonsoft.Json.Schema
CurrentSchema.AllowAdditionalProperties = false;
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
private void GenerateISerializableContract(Type type, JsonISerializableContract contract)
{
CurrentSchema.AllowAdditionalProperties = true;
@@ -435,7 +435,7 @@ namespace Newtonsoft.Json.Schema
case PrimitiveTypeCode.Empty:
case PrimitiveTypeCode.Object:
return schemaType | JsonSchemaType.String;
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
case PrimitiveTypeCode.DBNull:
return schemaType | JsonSchemaType.Null;
#endif
@@ -37,7 +37,7 @@ using System.Dynamic;
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System.Security.Permissions;
#endif
using System.Xml.Serialization;
@@ -106,7 +106,7 @@ namespace Newtonsoft.Json.Serialization
private static readonly JsonConverter[] BuiltInConverters =
{
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || DOTNET || PORTABLE40 || PORTABLE)
new EntityKeyMemberConverter(),
#endif
#if !(NET35 || NET20 || PORTABLE40)
@@ -115,15 +115,12 @@ namespace Newtonsoft.Json.Serialization
#if !(PORTABLE40)
new XmlNodeConverter(),
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
new BinaryConverter(),
new DataSetConverter(),
new DataTableConverter(),
#endif
#if NETFX_CORE
new JsonValueConverter(),
#endif
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
new DiscriminatedUnionConverter(),
#endif
new KeyValuePairConverter(),
@@ -149,7 +146,7 @@ namespace Newtonsoft.Json.Serialization
get { return JsonTypeReflector.DynamicCodeGeneration; }
}
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
/// <summary>
/// Gets or sets the default members search flags.
/// </summary>
@@ -157,7 +154,7 @@ namespace Newtonsoft.Json.Serialization
[ObsoleteAttribute("DefaultMembersSearchFlags is obsolete. To modify the members serialized inherit from DefaultContractResolver and override the GetSerializableMembers method instead.")]
public BindingFlags DefaultMembersSearchFlags { get; set; }
#else
private BindingFlags DefaultMembersSearchFlags = BindingFlags.Instance | BindingFlags.Public;
private BindingFlags DefaultMembersSearchFlags;
#endif
/// <summary>
@@ -168,7 +165,7 @@ namespace Newtonsoft.Json.Serialization
/// </value>
public bool SerializeCompilerGeneratedMembers { get; set; }
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
/// <summary>
/// Gets or sets a value indicating whether to ignore the <see cref="ISerializable"/> interface when serializing and deserializing types.
/// </summary>
@@ -191,14 +188,13 @@ namespace Newtonsoft.Json.Serialization
/// </summary>
public DefaultContractResolver()
{
#if !NETFX_CORE
#pragma warning disable 618
DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.Instance;
#pragma warning restore 618
#endif
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
IgnoreSerializableAttribute = true;
#endif
#pragma warning disable 618
DefaultMembersSearchFlags = BindingFlags.Instance | BindingFlags.Public;
#pragma warning restore 618
}
/// <summary>
@@ -268,7 +264,7 @@ namespace Newtonsoft.Json.Serialization
protected virtual List<MemberInfo> GetSerializableMembers(Type objectType)
{
bool ignoreSerializableAttribute;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
ignoreSerializableAttribute = IgnoreSerializableAttribute;
#else
ignoreSerializableAttribute = true;
@@ -366,7 +362,7 @@ namespace Newtonsoft.Json.Serialization
InitializeContract(contract);
bool ignoreSerializableAttribute;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
ignoreSerializableAttribute = IgnoreSerializableAttribute;
#else
ignoreSerializableAttribute = true;
@@ -393,7 +389,7 @@ namespace Newtonsoft.Json.Serialization
}
else if (contract.MemberSerialization == MemberSerialization.Fields)
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
// mimic DataContractSerializer behaviour when populating fields by overriding default creator to create an uninitialized object
// note that this is only possible when the application is fully trusted so fall back to using the default constructor (if available) in partial trust
if (JsonTypeReflector.FullyTrusted)
@@ -832,7 +828,7 @@ namespace Newtonsoft.Json.Serialization
if (t.IsGenericType() && t.GetGenericTypeDefinition() == typeof(ConcurrentDictionary<,>))
return true;
#endif
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
if (t.Name == FSharpUtils.FSharpSetTypeName || t.Name == FSharpUtils.FSharpMapTypeName)
return true;
#endif
@@ -842,11 +838,11 @@ namespace Newtonsoft.Json.Serialization
private static bool ShouldSkipSerializing(Type t)
{
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
if (t.Name == FSharpUtils.FSharpSetTypeName || t.Name == FSharpUtils.FSharpMapTypeName)
return true;
#endif
#if NETFX_CORE
#if DOTNET
if (t.IsGenericType() && t.GetGenericTypeDefinition() == typeof(ConcurrentDictionary<,>))
return true;
#endif
@@ -924,7 +920,7 @@ namespace Newtonsoft.Json.Serialization
return contract;
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Creates a <see cref="JsonISerializableContract"/> for the given type.
/// </summary>
@@ -1012,7 +1008,7 @@ namespace Newtonsoft.Json.Serialization
if (CanConvertToString(t))
return CreateStringContract(objectType);
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (!IgnoreSerializableInterface && typeof(ISerializable).IsAssignableFrom(t))
return CreateISerializableContract(objectType);
#endif
@@ -1022,7 +1018,7 @@ namespace Newtonsoft.Json.Serialization
return CreateDynamicContract(objectType);
#endif
#if !(PORTABLE || NETFX_CORE)
#if !PORTABLE
// tested last because it is not possible to automatically deserialize custom IConvertible types
if (IsIConvertible(t))
return CreatePrimitiveContract(t);
@@ -1038,7 +1034,7 @@ namespace Newtonsoft.Json.Serialization
return (typeCode != PrimitiveTypeCode.Empty && typeCode != PrimitiveTypeCode.Object);
}
#if !(PORTABLE || NETFX_CORE)
#if !PORTABLE
internal static bool IsIConvertible(Type t)
{
if (typeof(IConvertible).IsAssignableFrom(t)
@@ -1053,7 +1049,7 @@ namespace Newtonsoft.Json.Serialization
internal static bool CanConvertToString(Type type)
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
TypeConverter converter = ConvertUtils.GetConverter(type);
// use the objectType's TypeConverter if it has one and can convert to a string
@@ -1160,7 +1156,7 @@ namespace Newtonsoft.Json.Serialization
// warning - this method use to cause errors with Intellitrace. Retest in VS Ultimate after changes
IValueProvider valueProvider;
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
if (DynamicCodeGeneration)
valueProvider = new DynamicValueProvider(member);
else
@@ -1268,7 +1264,7 @@ namespace Newtonsoft.Json.Serialization
JsonTypeReflector.GetAttribute<JsonIgnoreAttribute>(attributeProvider) != null
// automatically ignore extension data dictionary property if it is public
|| JsonTypeReflector.GetAttribute<JsonExtensionDataAttribute>(attributeProvider) != null
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
|| JsonTypeReflector.GetAttribute<NonSerializedAttribute>(attributeProvider) != null
#endif
;
@@ -49,19 +49,19 @@ namespace Newtonsoft.Json.Serialization
{
Assembly assembly;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
// look, I don't like using obsolete methods as much as you do but this is the only way
// Assembly.Load won't check the GAC for a partial name
#pragma warning disable 618,612
assembly = Assembly.LoadWithPartialName(assemblyName);
#pragma warning restore 618,612
#elif NETFX_CORE || PORTABLE
#elif DOTNET || PORTABLE
assembly = Assembly.Load(new AssemblyName(assemblyName));
#else
assembly = Assembly.Load(assemblyName);
#endif
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
if (assembly == null)
{
// will find assemblies loaded with Assembly.LoadFile outside of the main directory
@@ -145,7 +145,7 @@ namespace Newtonsoft.Json.Serialization
/// <param name="typeName">Specifies the <see cref="T:System.Type"/> name of the serialized object. </param>
public override void BindToName(Type serializedType, out string assemblyName, out string typeName)
{
#if NETFX_CORE || PORTABLE
#if (DOTNET || PORTABLE)
assemblyName = serializedType.GetTypeInfo().Assembly.FullName;
typeName = serializedType.FullName;
#else
@@ -1,4 +1,4 @@
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
using System;
using System.Diagnostics;
using DiagnosticsTrace = System.Diagnostics.Trace;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
using System;
using System.Collections.Generic;
#if NET20
@@ -165,7 +165,7 @@ namespace Newtonsoft.Json.Serialization
_parametrizedConstructor = CollectionUtils.ResolveEnumerableCollectionConstructor(underlyingType, CollectionItemType);
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
if (!HasParametrizedCreator && underlyingType.Name == FSharpUtils.FSharpListTypeName)
{
FSharpUtils.EnsureInitialized(underlyingType.Assembly());
@@ -148,7 +148,7 @@ namespace Newtonsoft.Json.Serialization
{
_parametrizedConstructor = CollectionUtils.ResolveEnumerableCollectionConstructor(CreatedType, typeof(KeyValuePair<,>).MakeGenericType(keyType, valueType));
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
if (!HasParametrizedCreator && underlyingType.Name == FSharpUtils.FSharpMapTypeName)
{
FSharpUtils.EnsureInitialized(underlyingType.Assembly());
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Globalization;
using System.Runtime.Serialization;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System;
using System.Runtime.Serialization;
@@ -181,7 +181,7 @@ namespace Newtonsoft.Json.Serialization
CreatorParameters = new JsonPropertyCollection(UnderlyingType);
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
#if !(NET20 || NET35)
[SecuritySafeCritical]
#endif
@@ -43,13 +43,8 @@ namespace Newtonsoft.Json.Serialization
int IEqualityComparer<object>.GetHashCode(object obj)
{
#if !(NETFX_CORE)
// put objects in a bucket based on their reference
return RuntimeHelpers.GetHashCode(obj);
#else
// put all objects in the same bucket so ReferenceEquals is called on all
return -1;
#endif
}
}
@@ -291,7 +291,7 @@ namespace Newtonsoft.Json.Serialization
return EnsureType(reader, constructorName, CultureInfo.InvariantCulture, contract, objectType);
case JsonToken.Null:
case JsonToken.Undefined:
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (objectType == typeof(DBNull))
return DBNull.Value;
#endif
@@ -321,7 +321,7 @@ namespace Newtonsoft.Json.Serialization
{
case JsonContractType.Object:
case JsonContractType.Dictionary:
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
case JsonContractType.Serializable:
#endif
#if !(NET35 || NET20 || PORTABLE40)
@@ -508,7 +508,7 @@ namespace Newtonsoft.Json.Serialization
JsonDynamicContract dynamicContract = (JsonDynamicContract)contract;
return CreateDynamic(reader, dynamicContract, member, id);
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
case JsonContractType.Serializable:
JsonISerializableContract serializableContract = (JsonISerializableContract)contract;
return CreateISerializable(reader, serializableContract, member, id);
@@ -1444,7 +1444,7 @@ namespace Newtonsoft.Json.Serialization
return underlyingList;
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
private object CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, string id)
{
Type objectType = contract.UnderlyingType;
@@ -188,7 +188,7 @@ namespace Newtonsoft.Json.Serialization
SerializeDynamic(writer, (IDynamicMetaObjectProvider)value, (JsonDynamicContract)valueContract, member, containerContract, containerProperty);
break;
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
case JsonContractType.Serializable:
SerializeISerializable(writer, (ISerializable)value, (JsonISerializableContract)valueContract, member, containerContract, containerProperty);
break;
@@ -331,7 +331,7 @@ namespace Newtonsoft.Json.Serialization
internal static bool TryConvertToString(object value, Type type, out string s)
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
TypeConverter converter = ConvertUtils.GetConverter(type);
// use the objectType's TypeConverter if it has one and can convert to a string
@@ -347,12 +347,12 @@ namespace Newtonsoft.Json.Serialization
}
#endif
#if NETFX_CORE || PORTABLE
if (value is Guid || value is Uri || value is TimeSpan)
{
s = value.ToString();
return true;
}
#if (DOTNET || PORTABLE)
if (value is Guid || value is Uri || value is TimeSpan)
{
s = value.ToString();
return true;
}
#endif
if (value is Type)
@@ -739,7 +739,7 @@ namespace Newtonsoft.Json.Serialization
return writeMetadataObject;
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
#if !(NET20 || NET35)
[SecuritySafeCritical]
#endif
@@ -29,7 +29,7 @@ using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.Security;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System.Security.Permissions;
#endif
using Newtonsoft.Json.Utilities;
@@ -59,7 +59,7 @@ namespace Newtonsoft.Json.Serialization
private static readonly ThreadSafeStore<Type, Func<object[], JsonConverter>> JsonConverterCreatorCache =
new ThreadSafeStore<Type, Func<object[], JsonConverter>>(GetJsonConverterCreator);
#if !(NET20 || NETFX_CORE)
#if !(NET20 || DOTNET)
private static readonly ThreadSafeStore<Type, Type> AssociatedMetadataTypesCache = new ThreadSafeStore<Type, Type>(GetAssociateMetadataTypeFromAttribute);
private static ReflectionObject _metadataTypeAttributeReflectionObject;
#endif
@@ -131,7 +131,7 @@ namespace Newtonsoft.Json.Serialization
return MemberSerialization.OptIn;
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (!ignoreSerializableAttribute)
{
SerializableAttribute serializableAttribute = GetCachedAttribute<SerializableAttribute>(objectType);
@@ -214,14 +214,14 @@ namespace Newtonsoft.Json.Serialization
};
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(PORTABLE40 || PORTABLE)
public static TypeConverter GetTypeConverter(Type type)
{
return TypeDescriptor.GetConverter(type);
}
#endif
#if !(NET20 || NETFX_CORE)
#if !(NET20 || DOTNET)
private static Type GetAssociatedMetadataType(Type type)
{
return AssociatedMetadataTypesCache.Get(type);
@@ -256,7 +256,7 @@ namespace Newtonsoft.Json.Serialization
{
T attribute;
#if !(NET20 || NETFX_CORE)
#if !(NET20 || DOTNET)
Type metadataType = GetAssociatedMetadataType(type);
if (metadataType != null)
{
@@ -284,7 +284,7 @@ namespace Newtonsoft.Json.Serialization
{
T attribute;
#if !(NET20 || NETFX_CORE)
#if !(NET20 || DOTNET)
Type metadataType = GetAssociatedMetadataType(memberInfo.DeclaringType);
if (metadataType != null)
{
@@ -348,14 +348,14 @@ namespace Newtonsoft.Json.Serialization
public static bool DynamicCodeGeneration
{
#if !(NET20 || NET35 || NETFX_CORE || PORTABLE)
#if !(NET20 || NET35 || PORTABLE)
[SecuritySafeCritical]
#endif
get
{
if (_dynamicCodeGeneration == null)
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
try
{
new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
@@ -384,7 +384,7 @@ namespace Newtonsoft.Json.Serialization
{
if (_fullyTrusted == null)
{
#if (NETFX_CORE || PORTABLE || PORTABLE40)
#if (DOTNET || PORTABLE || PORTABLE40)
_fullyTrusted = false;
#elif !(NET20 || NET35 || PORTABLE40)
AppDomain appDomain = AppDomain.CurrentDomain;
@@ -411,7 +411,7 @@ namespace Newtonsoft.Json.Serialization
{
get
{
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
if (DynamicCodeGeneration)
return DynamicReflectionDelegateFactory.Instance;
+1 -1
View File
@@ -1,5 +1,5 @@

#if PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE
#if (DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Reflection;
+1 -1
View File
@@ -1,5 +1,5 @@

#if (NETFX_CORE || PORTABLE40 || PORTABLE)
#if (DOTNET || PORTABLE40 || PORTABLE)
using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json
+18 -18
View File
@@ -37,9 +37,8 @@ using System.Reflection;
#if NET20
using Newtonsoft.Json.Utilities.LinqBridge;
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System.Data.SqlTypes;
#endif
namespace Newtonsoft.Json.Utilities
@@ -152,14 +151,15 @@ namespace Newtonsoft.Json.Utilities
{ typeof(Uri), PrimitiveTypeCode.Uri },
{ typeof(string), PrimitiveTypeCode.String },
{ typeof(byte[]), PrimitiveTypeCode.Bytes },
#if !(PORTABLE || PORTABLE40 || NETFX_CORE)
#if !(PORTABLE || PORTABLE40 || DOTNET)
{ typeof(DBNull), PrimitiveTypeCode.DBNull }
#endif
};
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
private static readonly TypeInformation[] PrimitiveTypeCodes =
{
// need all of these. lookup against the index with TypeCode value
new TypeInformation { Type = typeof(object), TypeCode = PrimitiveTypeCode.Empty },
new TypeInformation { Type = typeof(object), TypeCode = PrimitiveTypeCode.Object },
new TypeInformation { Type = typeof(object), TypeCode = PrimitiveTypeCode.DBNull },
@@ -219,7 +219,7 @@ namespace Newtonsoft.Json.Utilities
return PrimitiveTypeCode.Object;
}
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
public static TypeInformation GetTypeInformation(IConvertible convertable)
{
TypeInformation typeInformation = PrimitiveTypeCodes[(int)convertable.GetTypeCode()];
@@ -229,12 +229,12 @@ namespace Newtonsoft.Json.Utilities
public static bool IsConvertible(Type t)
{
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
return typeof(IConvertible).IsAssignableFrom(t);
#else
return (
t == typeof(bool) || t == typeof(byte) || t == typeof(char) || t == typeof(DateTime) || t == typeof(decimal) || t == typeof(double) || t == typeof(short) || t == typeof(int) ||
t == typeof(long) || t == typeof(sbyte) || t == typeof(float) || t == typeof(string) || t == typeof(ushort) || t == typeof(uint) || t == typeof(ulong) || t.IsEnum());
return (
t == typeof(bool) || t == typeof(byte) || t == typeof(char) || t == typeof(DateTime) || t == typeof(decimal) || t == typeof(double) || t == typeof(short) || t == typeof(int) ||
t == typeof(long) || t == typeof(sbyte) || t == typeof(float) || t == typeof(string) || t == typeof(ushort) || t == typeof(uint) || t == typeof(ulong) || t.IsEnum());
#endif
}
@@ -353,7 +353,7 @@ namespace Newtonsoft.Json.Utilities
}
#endif
#region TryConvert
#region TryConvert
internal enum ConvertResult
{
Success = 0,
@@ -496,7 +496,7 @@ namespace Newtonsoft.Json.Utilities
}
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(PORTABLE40 || PORTABLE)
// see if source or target types have a TypeConverter that converts between the two
TypeConverter toConverter = GetConverter(initialType);
@@ -514,7 +514,7 @@ namespace Newtonsoft.Json.Utilities
return ConvertResult.Success;
}
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
// handle DBNull and INullable
if (initialValue == DBNull.Value)
{
@@ -529,7 +529,7 @@ namespace Newtonsoft.Json.Utilities
return ConvertResult.CannotConvertNull;
}
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (initialValue is INullable)
{
value = EnsureTypeAssignable(ToValue((INullable)initialValue), initialType, targetType);
@@ -546,9 +546,9 @@ namespace Newtonsoft.Json.Utilities
value = null;
return ConvertResult.NoValidConversion;
}
#endregion
#endregion
#region ConvertOrCast
#region ConvertOrCast
/// <summary>
/// Converts the value to the specified type. If the value is unable to be converted, the
/// value is checked whether it assignable to the specified type.
@@ -575,7 +575,7 @@ namespace Newtonsoft.Json.Utilities
return EnsureTypeAssignable(initialValue, ReflectionUtils.GetObjectType(initialValue), targetType);
}
#endregion
#endregion
private static object EnsureTypeAssignable(object value, Type initialType, Type targetType)
{
@@ -599,7 +599,7 @@ namespace Newtonsoft.Json.Utilities
throw new ArgumentException("Could not cast or convert from {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, (initialType != null) ? initialType.ToString() : "{null}", targetType));
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
public static object ToValue(INullable nullableValue)
{
if (nullableValue == null)
@@ -619,7 +619,7 @@ namespace Newtonsoft.Json.Utilities
}
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(PORTABLE40 || PORTABLE)
internal static TypeConverter GetConverter(Type t)
{
return JsonTypeReflector.GetTypeConverter(t);
@@ -57,7 +57,7 @@ namespace Newtonsoft.Json.Utilities
#endif
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(PORTABLE40 || PORTABLE)
public static XmlDateTimeSerializationMode ToSerializationMode(DateTimeKind kind)
{
switch (kind)
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(PORTABLE || NETFX_CORE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System;
using System.Collections.Generic;
#if NET20
+2 -2
View File
@@ -23,8 +23,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20)
using System.Threading;
#if !(NET35 || NET20 || NETFX_CORE)
using System;
using System.Collections.Generic;
using System.Linq;
@@ -112,7 +112,7 @@ namespace Newtonsoft.Json.Utilities
_mapType = fsharpCoreAssembly.GetType("Microsoft.FSharp.Collections.FSharpMap`2");
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
Thread.MemoryBarrier();
#endif
_initialized = true;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Reflection.Emit;
using System.Reflection;
@@ -43,7 +43,7 @@ using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json.Utilities
{
#if (NETFX_CORE || PORTABLE || PORTABLE40)
#if (DOTNET || PORTABLE || PORTABLE40)
internal enum MemberTypes
{
Property = 0,
@@ -54,7 +54,7 @@ namespace Newtonsoft.Json.Utilities
}
#endif
#if NETFX_CORE || PORTABLE
#if PORTABLE
[Flags]
internal enum BindingFlags
{
@@ -87,7 +87,7 @@ namespace Newtonsoft.Json.Utilities
static ReflectionUtils()
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(PORTABLE40 || PORTABLE)
EmptyTypes = Type.EmptyTypes;
#else
EmptyTypes = new Type[0];
@@ -669,7 +669,7 @@ namespace Newtonsoft.Json.Utilities
return (attributes != null) ? attributes.FirstOrDefault() : null;
}
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
public static T[] GetAttributes<T>(object attributeProvider, bool inherit) where T : Attribute
{
Attribute[] a = GetAttributes(attributeProvider, typeof(T), inherit);
@@ -848,7 +848,7 @@ namespace Newtonsoft.Json.Utilities
ValidationUtils.ArgumentNotNull(targetType, "targetType");
List<MemberInfo> fieldInfos = new List<MemberInfo>(targetType.GetFields(bindingAttr));
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
// Type.GetFields doesn't return inherited private fields
// manually find private fields from base class
GetChildPrivateFields(fieldInfos, targetType, bindingAttr);
@@ -857,7 +857,7 @@ namespace Newtonsoft.Json.Utilities
return fieldInfos.Cast<FieldInfo>();
}
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
private static void GetChildPrivateFields(IList<MemberInfo> initialFields, Type targetType, BindingFlags bindingAttr)
{
// fix weirdness with private FieldInfos only being returned for the current Type
+1 -1
View File
@@ -170,7 +170,7 @@ namespace Newtonsoft.Json.Utilities
if (i > 0 && hasNext && !char.IsUpper(chars[i + 1]))
break;
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
chars[i] = char.ToLower(chars[i], CultureInfo.InvariantCulture);
#else
chars[i] = char.ToLowerInvariant(chars[i]);
@@ -78,7 +78,7 @@ namespace Newtonsoft.Json.Utilities
Dictionary<TKey, TValue> newStore = new Dictionary<TKey, TValue>(_store);
newStore[key] = value;
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
Thread.MemoryBarrier();
#endif
_store = newStore;
+27 -56
View File
@@ -36,7 +36,8 @@ namespace Newtonsoft.Json.Utilities
{
internal static class TypeExtensions
{
#if NETFX_CORE || PORTABLE
#if DOTNET || PORTABLE
#if !DOTNET
private static BindingFlags DefaultFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
public static MethodInfo GetGetMethod(this PropertyInfo propertyInfo)
@@ -66,29 +67,32 @@ namespace Newtonsoft.Json.Utilities
return null;
}
#endif
public static bool IsSubclassOf(this Type type, Type c)
{
return type.GetTypeInfo().IsSubclassOf(c);
}
#if !DOTNET
public static bool IsAssignableFrom(this Type type, Type c)
{
return type.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo());
}
#endif
public static bool IsInstanceOfType(this Type type, object o)
{
if (o == null)
return false;
return IsAssignableFrom(type, o.GetType());
return type.IsAssignableFrom(o.GetType());
}
#endif
public static MethodInfo Method(this Delegate d)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return d.Method;
#else
return d.GetMethodInfo();
@@ -97,7 +101,7 @@ namespace Newtonsoft.Json.Utilities
public static MemberTypes MemberType(this MemberInfo memberInfo)
{
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
return memberInfo.MemberType;
#else
if (memberInfo is PropertyInfo)
@@ -115,7 +119,7 @@ namespace Newtonsoft.Json.Utilities
public static bool ContainsGenericParameters(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.ContainsGenericParameters;
#else
return type.GetTypeInfo().ContainsGenericParameters;
@@ -124,7 +128,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsInterface(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsInterface;
#else
return type.GetTypeInfo().IsInterface;
@@ -133,7 +137,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsGenericType(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsGenericType;
#else
return type.GetTypeInfo().IsGenericType;
@@ -142,7 +146,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsGenericTypeDefinition(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsGenericTypeDefinition;
#else
return type.GetTypeInfo().IsGenericTypeDefinition;
@@ -151,7 +155,7 @@ namespace Newtonsoft.Json.Utilities
public static Type BaseType(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.BaseType;
#else
return type.GetTypeInfo().BaseType;
@@ -160,7 +164,7 @@ namespace Newtonsoft.Json.Utilities
public static Assembly Assembly(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.Assembly;
#else
return type.GetTypeInfo().Assembly;
@@ -169,7 +173,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsEnum(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsEnum;
#else
return type.GetTypeInfo().IsEnum;
@@ -178,7 +182,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsClass(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsClass;
#else
return type.GetTypeInfo().IsClass;
@@ -187,17 +191,17 @@ namespace Newtonsoft.Json.Utilities
public static bool IsSealed(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsSealed;
#else
return type.GetTypeInfo().IsSealed;
#endif
}
#if PORTABLE40
#if (PORTABLE40 || DOTNET || PORTABLE)
public static PropertyInfo GetProperty(this Type type, string name, BindingFlags bindingFlags, object placeholder1, Type propertyType, IList<Type> indexParameters, object placeholder2)
{
IList<PropertyInfo> propertyInfos = type.GetProperties(bindingFlags);
IEnumerable<PropertyInfo> propertyInfos = type.GetProperties(bindingFlags);
return propertyInfos.Where(p =>
{
@@ -217,10 +221,8 @@ namespace Newtonsoft.Json.Utilities
public static IEnumerable<MemberInfo> GetMember(this Type type, string name, MemberTypes memberType, BindingFlags bindingFlags)
{
return type.GetMembers(bindingFlags).Where(m =>
return type.GetMember(name, bindingFlags).Where(m =>
{
if (name != null && name != m.Name)
return false;
if (m.MemberType() != memberType)
return false;
@@ -229,19 +231,20 @@ namespace Newtonsoft.Json.Utilities
}
#endif
#if (NETFX_CORE || PORTABLE)
#if (DOTNET || PORTABLE)
public static MethodInfo GetBaseDefinition(this MethodInfo method)
{
return method.GetRuntimeBaseDefinition();
}
#endif
#if (NETFX_CORE || PORTABLE)
#if (DOTNET || PORTABLE)
public static bool IsDefined(this Type type, Type attributeType, bool inherit)
{
return type.GetTypeInfo().CustomAttributes.Any(a => a.AttributeType == attributeType);
}
#if !DOTNET
public static MethodInfo GetMethod(this Type type, string name)
{
return type.GetMethod(name, DefaultFlags);
@@ -276,39 +279,6 @@ namespace Newtonsoft.Json.Utilities
}).SingleOrDefault();
}
public static PropertyInfo GetProperty(this Type type, string name, BindingFlags bindingFlags, object placeholder1, Type propertyType, IList<Type> indexParameters, object placeholder2)
{
return type.GetTypeInfo().DeclaredProperties.Where(p =>
{
if (name != null && name != p.Name)
return false;
if (propertyType != null && propertyType != p.PropertyType)
return false;
if (indexParameters != null)
{
if (!p.GetIndexParameters().Select(ip => ip.ParameterType).SequenceEqual(indexParameters))
return false;
}
return true;
}).SingleOrDefault();
}
public static IEnumerable<MemberInfo> GetMember(this Type type, string name, MemberTypes memberType, BindingFlags bindingFlags)
{
return type.GetTypeInfo().GetMembersRecursive().Where(m =>
{
if (name != null && name != m.Name)
return false;
if (m.MemberType() != memberType)
return false;
if (!TestAccessibility(m, bindingFlags))
return false;
return true;
});
}
public static IEnumerable<ConstructorInfo> GetConstructors(this Type type)
{
return type.GetConstructors(DefaultFlags);
@@ -517,11 +487,12 @@ namespace Newtonsoft.Json.Utilities
{
return type.GetTypeInfo().DeclaredMethods;
}
#endif
#endif
public static bool IsAbstract(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsAbstract;
#else
return type.GetTypeInfo().IsAbstract;
@@ -530,7 +501,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsVisible(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsVisible;
#else
return type.GetTypeInfo().IsVisible;
@@ -539,7 +510,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsValueType(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsValueType;
#else
return type.GetTypeInfo().IsValueType;
+36
View File
@@ -0,0 +1,36 @@
{
"version": "7.0.2-beta1-*",
"description": "Json.NET is a popular high-performance JSON framework for .NET",
"authors": [ "James Newton-King" ],
"tags": [ "json" ],
"projectUrl": "http://www.newtonsoft.com/json",
"licenseUrl": "https://raw.github.com/JamesNK/Newtonsoft.Json/master/LICENSE.md",
"frameworks": {
"dotnet": {
"dependencies": {
"Microsoft.CSharp": "4.0.0-beta-*",
"System.Collections": "4.0.10-beta-*",
"System.Collections.Concurrent": "4.0.10-beta-*",
"System.ComponentModel.TypeConverter": "4.0.0-beta-*",
"System.Diagnostics.Debug": "4.0.10-beta-*",
"System.Diagnostics.Tools": "4.0.0-beta-*",
"System.Dynamic.Runtime": "4.0.10-beta-*",
"System.Globalization": "4.0.10-beta-*",
"System.IO": "4.0.10-beta-*",
"System.Linq": "4.0.0-beta-*",
"System.Linq.Expressions": "4.0.10-beta-*",
"System.Runtime": "4.0.20-beta-*",
"System.Runtime.Extensions": "4.0.10-beta-*",
"System.Runtime.Numerics": "4.0.0-beta-*",
"System.Runtime.Serialization.Primitives": "4.0.10-beta-*",
"System.Text.Encoding": "4.0.10-beta-*",
"System.Text.Encoding.Extensions": "4.0.10-beta-*",
"System.Text.RegularExpressions": "4.0.10-beta-*",
"System.Threading": "4.0.10-beta-*",
"System.Xml.ReaderWriter": "4.0.10-beta-*",
"System.Xml.XDocument": "4.0.10-beta-*"
}
}
}
}
+2 -1
View File
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="Offical NuGet.org" value="https://nuget.org/api/v2/" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

Some files were not shown because too many files have changed in this diff Show More