diff --git a/.gitignore b/.gitignore index 71ed5b23..77d94f81 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ _ReSharper.* *.resharper.user project.lock.json *.xproj +.vs/ +*.props +*.targets #NuGet packages diff --git a/Build/build.ps1 b/Build/build.ps1 index a52875e0..34d1b2f1 100644 --- a/Build/build.ps1 +++ b/Build/build.ps1 @@ -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 diff --git a/Src/Newtonsoft.Json.Dotnet.sln b/Src/Newtonsoft.Json.Dotnet.sln new file mode 100644 index 00000000..733e00dd --- /dev/null +++ b/Src/Newtonsoft.Json.Dotnet.sln @@ -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 diff --git a/Src/Newtonsoft.Json.Net20.sln b/Src/Newtonsoft.Json.Net20.sln index 06603606..ebb76225 100644 --- a/Src/Newtonsoft.Json.Net20.sln +++ b/Src/Newtonsoft.Json.Net20.sln @@ -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 diff --git a/Src/Newtonsoft.Json.Net35.sln b/Src/Newtonsoft.Json.Net35.sln index f14f68c0..eb7de416 100644 --- a/Src/Newtonsoft.Json.Net35.sln +++ b/Src/Newtonsoft.Json.Net35.sln @@ -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}" diff --git a/Src/Newtonsoft.Json.Net40.sln b/Src/Newtonsoft.Json.Net40.sln index 1b09e98d..5af5dcbc 100644 --- a/Src/Newtonsoft.Json.Net40.sln +++ b/Src/Newtonsoft.Json.Net40.sln @@ -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 diff --git a/Src/Newtonsoft.Json.Portable.sln b/Src/Newtonsoft.Json.Portable.sln index ef75c820..21705b08 100644 --- a/Src/Newtonsoft.Json.Portable.sln +++ b/Src/Newtonsoft.Json.Portable.sln @@ -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 diff --git a/Src/Newtonsoft.Json.Portable40.sln b/Src/Newtonsoft.Json.Portable40.sln index 37e89da6..0529cddc 100644 --- a/Src/Newtonsoft.Json.Portable40.sln +++ b/Src/Newtonsoft.Json.Portable40.sln @@ -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 diff --git a/Src/Newtonsoft.Json.TestConsole/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.TestConsole/Properties/AssemblyInfo.cs index 6e080d9b..0e0a3394 100644 --- a/Src/Newtonsoft.Json.TestConsole/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json.TestConsole/Properties/AssemblyInfo.cs @@ -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")] diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs index d0085bd0..bf740f15 100644 --- a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs +++ b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs @@ -30,7 +30,7 @@ using System.Reflection; using System.Runtime.Serialization; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; -#if !(NET20 || NET35 || PORTABLE || 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; } diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs index 898e8e1c..ebfeed01 100644 --- a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if !(NET20 || NET35 || PORTABLE || 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() { diff --git a/Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs b/Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs index 5c6b156f..a33e6ce9 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs @@ -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; } diff --git a/Src/Newtonsoft.Json.Tests/Converters/DiscriminatedUnionConverterTests.cs b/Src/Newtonsoft.Json.Tests/Converters/DiscriminatedUnionConverterTests.cs index 1d12cbfa..f422a2a5 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/DiscriminatedUnionConverterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/DiscriminatedUnionConverterTests.cs @@ -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; diff --git a/Src/Newtonsoft.Json.Tests/Documentation/Samples/Serializer/DefaultSettings.cs b/Src/Newtonsoft.Json.Tests/Documentation/Samples/Serializer/DefaultSettings.cs index efccf0fe..87f9c114 100644 --- a/Src/Newtonsoft.Json.Tests/Documentation/Samples/Serializer/DefaultSettings.cs +++ b/Src/Newtonsoft.Json.Tests/Documentation/Samples/Serializer/DefaultSettings.cs @@ -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"", diff --git a/Src/Newtonsoft.Json.Tests/Images/UnitTestLogo.png b/Src/Newtonsoft.Json.Tests/Images/UnitTestLogo.png deleted file mode 100644 index ebd735aa..00000000 Binary files a/Src/Newtonsoft.Json.Tests/Images/UnitTestLogo.png and /dev/null differ diff --git a/Src/Newtonsoft.Json.Tests/Images/UnitTestSmallLogo.png b/Src/Newtonsoft.Json.Tests/Images/UnitTestSmallLogo.png deleted file mode 100644 index 92dd1058..00000000 Binary files a/Src/Newtonsoft.Json.Tests/Images/UnitTestSmallLogo.png and /dev/null differ diff --git a/Src/Newtonsoft.Json.Tests/Images/UnitTestSplashScreen.png b/Src/Newtonsoft.Json.Tests/Images/UnitTestSplashScreen.png deleted file mode 100644 index 193187f1..00000000 Binary files a/Src/Newtonsoft.Json.Tests/Images/UnitTestSplashScreen.png and /dev/null differ diff --git a/Src/Newtonsoft.Json.Tests/Images/UnitTestStoreLogo.png b/Src/Newtonsoft.Json.Tests/Images/UnitTestStoreLogo.png deleted file mode 100644 index 3765186d..00000000 Binary files a/Src/Newtonsoft.Json.Tests/Images/UnitTestStoreLogo.png and /dev/null differ diff --git a/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs b/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs index 505396b7..d811cc99 100644 --- a/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs @@ -28,7 +28,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using Newtonsoft.Json.Schema; -#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || 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() { diff --git a/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs b/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs index fbd29ce7..db891888 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs @@ -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() { diff --git a/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs b/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs index b078d883..9724f1ef 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs @@ -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; diff --git a/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs b/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs index 09a3ffc2..01e3bcb5 100644 --- a/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs +++ b/Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs @@ -30,7 +30,7 @@ using System.IO; #if NET20 using Newtonsoft.Json.Utilities.LinqBridge; #endif -#if !(NET20 || NET35 || PORTABLE || 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() { diff --git a/Src/Newtonsoft.Json.Tests/Linq/AnnotationsTests.cs b/Src/Newtonsoft.Json.Tests/Linq/AnnotationsTests.cs index b9caf638..e61c5ac6 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/AnnotationsTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/AnnotationsTests.cs @@ -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 { diff --git a/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs b/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs index 885715ce..d19caacc 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Dynamic; using System.Linq; -#if !(NET20 || NET35 || PORTABLE || 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(null); AssertValueConverted(new Uri("http://json.codeplex.com/")); AssertValueConverted(null); -#if !(NET20 || NET35 || PORTABLE || DNXCORE50) +#if !(NET20 || NET35 || PORTABLE) AssertValueConverted(new BigInteger(100)); AssertValueConverted(null); #endif diff --git a/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs index 98555a04..d39e5dd7 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs @@ -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() { diff --git a/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs index d048bae2..ddcc44b2 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if !(NET20 || NET35 || PORTABLE || 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(() => { 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(() => { var i = (new JValue(new Uri("http://www.google.com"))).ToObject(); }, "Can not convert Uri to BigInteger."); ExceptionAssert.Throws(() => { var i = (JValue.CreateNull()).ToObject(); }, "Can not convert Null to BigInteger."); ExceptionAssert.Throws(() => { var i = (new JValue(Guid.NewGuid())).ToObject(); }, "Can not convert Guid to BigInteger."); @@ -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))); diff --git a/Src/Newtonsoft.Json.Tests/Linq/JTokenWriterTest.cs b/Src/Newtonsoft.Json.Tests/Linq/JTokenWriterTest.cs index 98ac87d5..a32d55c1 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JTokenWriterTest.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JTokenWriterTest.cs @@ -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() { diff --git a/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs index 5b3a8644..25fbcf87 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs @@ -28,7 +28,7 @@ using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; using Newtonsoft.Json.Tests.TestObjects; -#if !(NET20 || NET35 || PORTABLE || 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() { diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj deleted file mode 100644 index 0853b2e3..00000000 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj +++ /dev/null @@ -1,402 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B} - Library - Properties - Newtonsoft.Json.Tests - Newtonsoft.Json.Tests - en-US - 512 - {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Newtonsoft.Json.Tests.WinRT_TemporaryKey.pfx - 3116117C65F73A227A0BDC35F584F04145BA4BB7 - False - - - true - full - false - bin\Debug\WinRT\ - DEBUG;TRACE;NETFX_CORE - prompt - 4 - - - pdbonly - true - bin\Release\WinRT\ - TRACE;NETFX_CORE - prompt - 4 - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - ARM - false - prompt - ExpressRules.ruleset - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - ARM - false - prompt - ExpressRules.ruleset - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x64 - false - prompt - ExpressRules.ruleset - true - - - bin\x64\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x64 - false - prompt - ExpressRules.ruleset - true - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x86 - false - prompt - ExpressRules.ruleset - true - - - bin\x86\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x86 - false - prompt - ExpressRules.ruleset - true - - - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - {263136a2-b89b-424e-a87a-f988caa8d032} - Newtonsoft.Json.WinRT - - - - - PreserveNewest - - - - PreserveNewest - - - - - ..\packages\System.Collections.Immutable.1.1.33-beta\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll - True - - - - 12.0 - - - - \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT_TemporaryKey.pfx b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT_TemporaryKey.pfx deleted file mode 100644 index 4edf74d9..00000000 Binary files a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT_TemporaryKey.pfx and /dev/null differ diff --git a/Src/Newtonsoft.Json.Tests/Package.appxmanifest b/Src/Newtonsoft.Json.Tests/Package.appxmanifest deleted file mode 100644 index c74bed55..00000000 --- a/Src/Newtonsoft.Json.Tests/Package.appxmanifest +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Newtonsoft.Json.Tests.WinRT - James - Images\UnitTestStoreLogo.png - Newtonsoft.Json.Tests.WinRT - - - 6.2 - 6.2 - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs index 7968f7e4..eb7a3cdc 100644 --- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs @@ -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")] diff --git a/Src/Newtonsoft.Json.Tests/Schema/PerformanceTests.cs b/Src/Newtonsoft.Json.Tests/Schema/PerformanceTests.cs index b783fe4b..246b2b22 100644 --- a/Src/Newtonsoft.Json.Tests/Schema/PerformanceTests.cs +++ b/Src/Newtonsoft.Json.Tests/Schema/PerformanceTests.cs @@ -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 { diff --git a/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs index 6ce098f4..0efad3e6 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs @@ -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() diff --git a/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs index e5893728..6aeae522 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs @@ -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, - ""k__BackingField"": ""Property"", - ""k__BackingField"": 2, - ""StringProperty"": ""Property"", - ""IntProperty"": 2 -}", includeCompilerGeneratedJson); + JObject o = JObject.Parse(includeCompilerGeneratedJson); + + Console.WriteLine(includeCompilerGeneratedJson); + + Assert.AreEqual("Property", (string)o["k__BackingField"]); + Assert.AreEqual(2, (int)o["k__BackingField"]); } #pragma warning restore 618 #endif diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs index ce4125d2..369c0fb9 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs @@ -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) diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs index b77d9f49..7f11634e 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs @@ -29,7 +29,7 @@ using System.ComponentModel; using System.Collections.Concurrent; #endif using System.Collections.Generic; -#if !(NET20 || NET35 || PORTABLE || 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(() => { List numbers = JsonConvert.DeserializeObject>(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(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() { diff --git a/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs index 4e12faef..4d39ffb2 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Globalization; using System.IO; using Newtonsoft.Json.Linq; -#if !(NET20 || NET35 || PORTABLE || 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() { diff --git a/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs b/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs index 0e26ce07..32f2bf2e 100644 --- a/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs +++ b/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs @@ -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; diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs b/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs index 4cf6b890..84ea10f7 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs @@ -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()); diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/ListOfIds.cs b/Src/Newtonsoft.Json.Tests/TestObjects/ListOfIds.cs index a34e3088..9333c511 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/ListOfIds.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/ListOfIds.cs @@ -26,6 +26,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json.Utilities; +using System.Reflection; namespace Newtonsoft.Json.Tests.TestObjects { diff --git a/Src/Newtonsoft.Json.Tests/Utilities/DateTimeUtilsTests.cs b/Src/Newtonsoft.Json.Tests/Utilities/DateTimeUtilsTests.cs index 58aa9c5f..90efefa9 100644 --- a/Src/Newtonsoft.Json.Tests/Utilities/DateTimeUtilsTests.cs +++ b/Src/Newtonsoft.Json.Tests/Utilities/DateTimeUtilsTests.cs @@ -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 } diff --git a/Src/Newtonsoft.Json.Tests/project.json b/Src/Newtonsoft.Json.Tests/project.json index d2388900..5062c0eb 100644 --- a/Src/Newtonsoft.Json.Tests/project.json +++ b/Src/Newtonsoft.Json.Tests/project.json @@ -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-*" + } } + } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.WinRT.sln b/Src/Newtonsoft.Json.WinRT.sln deleted file mode 100644 index b7832c4d..00000000 --- a/Src/Newtonsoft.Json.WinRT.sln +++ /dev/null @@ -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 diff --git a/Src/Newtonsoft.Json.sln b/Src/Newtonsoft.Json.sln index 803fed3c..d7956f25 100644 --- a/Src/Newtonsoft.Json.sln +++ b/Src/Newtonsoft.Json.sln @@ -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 diff --git a/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs b/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs index b0f40262..d2e09cdb 100644 --- a/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs +++ b/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs @@ -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(); diff --git a/Src/Newtonsoft.Json/Bson/BsonReader.cs b/Src/Newtonsoft.Json/Bson/BsonReader.cs index 9f07f3fc..4c3effc5 100644 --- a/Src/Newtonsoft.Json/Bson/BsonReader.cs +++ b/Src/Newtonsoft.Json/Bson/BsonReader.cs @@ -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(); diff --git a/Src/Newtonsoft.Json/Bson/BsonWriter.cs b/Src/Newtonsoft.Json/Bson/BsonWriter.cs index 16196a5a..810ca477 100644 --- a/Src/Newtonsoft.Json/Bson/BsonWriter.cs +++ b/Src/Newtonsoft.Json/Bson/BsonWriter.cs @@ -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(); diff --git a/Src/Newtonsoft.Json/Converters/BinaryConverter.cs b/Src/Newtonsoft.Json/Converters/BinaryConverter.cs index 6c2284db..516ce8fc 100644 --- a/Src/Newtonsoft.Json/Converters/BinaryConverter.cs +++ b/Src/Newtonsoft.Json/Converters/BinaryConverter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Converters/CustomCreationConverter.cs b/Src/Newtonsoft.Json/Converters/CustomCreationConverter.cs index adf519b6..68fe6800 100644 --- a/Src/Newtonsoft.Json/Converters/CustomCreationConverter.cs +++ b/Src/Newtonsoft.Json/Converters/CustomCreationConverter.cs @@ -24,6 +24,7 @@ #endregion using System; +using System.Reflection; using Newtonsoft.Json.Utilities; namespace Newtonsoft.Json.Converters diff --git a/Src/Newtonsoft.Json/Converters/DataSetConverter.cs b/Src/Newtonsoft.Json/Converters/DataSetConverter.cs index d39c6b48..adfdef5d 100644 --- a/Src/Newtonsoft.Json/Converters/DataSetConverter.cs +++ b/Src/Newtonsoft.Json/Converters/DataSetConverter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Converters/DataTableConverter.cs b/Src/Newtonsoft.Json/Converters/DataTableConverter.cs index 41a6b776..5779d9ee 100644 --- a/Src/Newtonsoft.Json/Converters/DataTableConverter.cs +++ b/Src/Newtonsoft.Json/Converters/DataTableConverter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Converters/DiscriminatedUnionConverter.cs b/Src/Newtonsoft.Json/Converters/DiscriminatedUnionConverter.cs index 134ecec4..b4a84c23 100644 --- a/Src/Newtonsoft.Json/Converters/DiscriminatedUnionConverter.cs +++ b/Src/Newtonsoft.Json/Converters/DiscriminatedUnionConverter.cs @@ -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 /// public class DiscriminatedUnionConverter : JsonConverter { - #region UnionDefinition +#region UnionDefinition internal class Union { public List 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(); diff --git a/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs b/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs index d3b10751..92a26649 100644 --- a/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs +++ b/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs index cfe5d0eb..1b719748 100644 --- a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs @@ -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 diff --git a/Src/Newtonsoft.Json/FormatterAssemblyStyle.cs b/Src/Newtonsoft.Json/FormatterAssemblyStyle.cs index 39d3f73a..d08cc337 100644 --- a/Src/Newtonsoft.Json/FormatterAssemblyStyle.cs +++ b/Src/Newtonsoft.Json/FormatterAssemblyStyle.cs @@ -1,5 +1,5 @@  -#if PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE +#if DOTNET || PORTABLE40 || PORTABLE namespace System.Runtime.Serialization.Formatters { diff --git a/Src/Newtonsoft.Json/JsonConvert.cs b/Src/Newtonsoft.Json/JsonConvert.cs index 3176dcff..fdb0deb3 100644 --- a/Src/Newtonsoft.Json/JsonConvert.cs +++ b/Src/Newtonsoft.Json/JsonConvert.cs @@ -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) /// /// Serializes the XML node to a JSON string. /// diff --git a/Src/Newtonsoft.Json/JsonException.cs b/Src/Newtonsoft.Json/JsonException.cs index 7072ffd3..97ea7242 100644 --- a/Src/Newtonsoft.Json/JsonException.cs +++ b/Src/Newtonsoft.Json/JsonException.cs @@ -35,7 +35,7 @@ namespace Newtonsoft.Json /// /// The exception thrown when an error occurs during JSON serialization or deserialization. /// -#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) /// /// Initializes a new instance of the class. /// diff --git a/Src/Newtonsoft.Json/JsonReaderException.cs b/Src/Newtonsoft.Json/JsonReaderException.cs index bd871062..9f448c4b 100644 --- a/Src/Newtonsoft.Json/JsonReaderException.cs +++ b/Src/Newtonsoft.Json/JsonReaderException.cs @@ -33,7 +33,7 @@ namespace Newtonsoft.Json /// /// The exception thrown when an error occurs while reading JSON text. /// -#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) /// /// Initializes a new instance of the class. /// diff --git a/Src/Newtonsoft.Json/JsonSerializationException.cs b/Src/Newtonsoft.Json/JsonSerializationException.cs index 5680a541..1c872c78 100644 --- a/Src/Newtonsoft.Json/JsonSerializationException.cs +++ b/Src/Newtonsoft.Json/JsonSerializationException.cs @@ -33,7 +33,7 @@ namespace Newtonsoft.Json /// /// The exception thrown when an error occurs during JSON serialization or deserialization. /// -#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) /// /// Initializes a new instance of the class. /// diff --git a/Src/Newtonsoft.Json/JsonTextReader.cs b/Src/Newtonsoft.Json/JsonTextReader.cs index 302acfad..54343a1b 100644 --- a/Src/Newtonsoft.Json/JsonTextReader.cs +++ b/Src/Newtonsoft.Json/JsonTextReader.cs @@ -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(); diff --git a/Src/Newtonsoft.Json/JsonTextWriter.cs b/Src/Newtonsoft.Json/JsonTextWriter.cs index 2fdd8372..9e29ec8c 100644 --- a/Src/Newtonsoft.Json/JsonTextWriter.cs +++ b/Src/Newtonsoft.Json/JsonTextWriter.cs @@ -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 + } } /// @@ -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"); diff --git a/Src/Newtonsoft.Json/JsonWriter.cs b/Src/Newtonsoft.Json/JsonWriter.cs index 689a5652..b8706efc 100644 --- a/Src/Newtonsoft.Json/JsonWriter.cs +++ b/Src/Newtonsoft.Json/JsonWriter.cs @@ -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 diff --git a/Src/Newtonsoft.Json/JsonWriterException.cs b/Src/Newtonsoft.Json/JsonWriterException.cs index 4ed62c1a..2bfa78db 100644 --- a/Src/Newtonsoft.Json/JsonWriterException.cs +++ b/Src/Newtonsoft.Json/JsonWriterException.cs @@ -33,7 +33,7 @@ namespace Newtonsoft.Json /// /// The exception thrown when an error occurs while reading JSON text. /// -#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) /// /// Initializes a new instance of the class. /// diff --git a/Src/Newtonsoft.Json/Linq/JContainer.cs b/Src/Newtonsoft.Json/Linq/JContainer.cs index cb662d99..a705b577 100644 --- a/Src/Newtonsoft.Json/Linq/JContainer.cs +++ b/Src/Newtonsoft.Json/Linq/JContainer.cs @@ -46,17 +46,15 @@ namespace Newtonsoft.Json.Linq /// Represents a token that can contain other tokens. /// public abstract class JContainer : JToken, IList -#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(); } -#if !(NETFX_CORE || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE) /// /// Raises the event. /// @@ -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) { } diff --git a/Src/Newtonsoft.Json/Linq/JObject.cs b/Src/Newtonsoft.Json/Linq/JObject.cs index 0ef4b0ea..a7b354cd 100644 --- a/Src/Newtonsoft.Json/Linq/JObject.cs +++ b/Src/Newtonsoft.Json/Linq/JObject.cs @@ -52,10 +52,10 @@ namespace Newtonsoft.Json.Linq /// /// public class JObject : JContainer, IDictionary, 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 /// public event PropertyChangedEventHandler PropertyChanged; -#if !(NET20 || NETFX_CORE || PORTABLE || PORTABLE40) +#if !(NET20 || PORTABLE || PORTABLE40) /// /// Occurs when a property value is changing. /// @@ -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) /// /// Raises the event with the provided arguments. /// @@ -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 diff --git a/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs b/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs index 71360a83..00eb8575 100644 --- a/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs +++ b/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NETFX_CORE || PORTABLE || PORTABLE40) +#if !(DOTNET || PORTABLE || PORTABLE40) using System; using System.ComponentModel; diff --git a/Src/Newtonsoft.Json/Linq/JToken.cs b/Src/Newtonsoft.Json/Linq/JToken.cs index b3f4df01..61abfa91 100644 --- a/Src/Newtonsoft.Json/Linq/JToken.cs +++ b/Src/Newtonsoft.Json/Linq/JToken.cs @@ -52,7 +52,7 @@ namespace Newtonsoft.Json.Linq /// Represents an abstract JSON token. /// public abstract class JToken : IJEnumerable, 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(); diff --git a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs index a2dfbe86..dd81f5d2 100644 --- a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs @@ -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(); diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index 0033ca34..048e4c42 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -42,7 +42,7 @@ namespace Newtonsoft.Json.Linq /// Represents a value in JSON (string, integer, date, etc). /// public class JValue : JToken, IEquatable, IFormattable, IComparable, IComparable -#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 - } + } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj deleted file mode 100644 index 0a7acf63..00000000 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj +++ /dev/null @@ -1,320 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {263136A2-B89B-424E-A87A-F988CAA8D032} - Library - Properties - Newtonsoft.Json - Newtonsoft.Json - en-US - 512 - {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - true - full - false - bin\Debug\WinRT\ - DEBUG;TRACE;NETFX_CORE - prompt - 3 - Newtonsoft.Json.ruleset - true - - - pdbonly - true - bin\Release\WinRT\ - TRACE;NETFX_CORE - prompt - 4 - bin\Release\WinRT\Newtonsoft.Json.xml - true - Newtonsoft.Json.ruleset - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - ARM - false - prompt - ExpressRules.ruleset - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - ARM - false - prompt - ExpressRules.ruleset - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x64 - false - prompt - ExpressRules.ruleset - true - - - bin\x64\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x64 - false - prompt - ExpressRules.ruleset - true - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x86 - false - prompt - ExpressRules.ruleset - true - - - bin\x86\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x86 - false - prompt - ExpressRules.ruleset - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12.0 - - - - \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs index d69ec8c2..27343e4e 100644 --- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -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)] diff --git a/Src/Newtonsoft.Json/Schema/JsonSchemaException.cs b/Src/Newtonsoft.Json/Schema/JsonSchemaException.cs index 51d46459..9b44cee3 100644 --- a/Src/Newtonsoft.Json/Schema/JsonSchemaException.cs +++ b/Src/Newtonsoft.Json/Schema/JsonSchemaException.cs @@ -36,7 +36,7 @@ namespace Newtonsoft.Json.Schema /// JSON Schema validation has been moved to its own package. See http://www.newtonsoft.com/jsonschema for more details. /// /// -#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) /// /// Initializes a new instance of the class. /// diff --git a/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs b/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs index bb1d759d..a61f9ec6 100644 --- a/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs +++ b/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs @@ -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(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 diff --git a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs index dba6a228..d0ffd560 100644 --- a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs +++ b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs @@ -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 /// /// Gets or sets the default members search flags. /// @@ -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 /// @@ -168,7 +165,7 @@ namespace Newtonsoft.Json.Serialization /// public bool SerializeCompilerGeneratedMembers { get; set; } -#if !(NETFX_CORE || PORTABLE || PORTABLE40) +#if !(DOTNET || PORTABLE || PORTABLE40) /// /// Gets or sets a value indicating whether to ignore the interface when serializing and deserializing types. /// @@ -191,14 +188,13 @@ namespace Newtonsoft.Json.Serialization /// 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 } /// @@ -268,7 +264,7 @@ namespace Newtonsoft.Json.Serialization protected virtual List 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) /// /// Creates a for the given type. /// @@ -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(attributeProvider) != null // automatically ignore extension data dictionary property if it is public || JsonTypeReflector.GetAttribute(attributeProvider) != null -#if !(NETFX_CORE || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE) || JsonTypeReflector.GetAttribute(attributeProvider) != null #endif ; diff --git a/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs b/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs index 98855b44..b3120ef9 100644 --- a/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs +++ b/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs @@ -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 /// Specifies the name of the serialized object. 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 diff --git a/Src/Newtonsoft.Json/Serialization/DiagnosticsTraceWriter.cs b/Src/Newtonsoft.Json/Serialization/DiagnosticsTraceWriter.cs index ef00dd2b..1b3f17b4 100644 --- a/Src/Newtonsoft.Json/Serialization/DiagnosticsTraceWriter.cs +++ b/Src/Newtonsoft.Json/Serialization/DiagnosticsTraceWriter.cs @@ -1,4 +1,4 @@ -#if !(PORTABLE40 || PORTABLE || NETFX_CORE) +#if !(PORTABLE40 || PORTABLE || DOTNET) using System; using System.Diagnostics; using DiagnosticsTrace = System.Diagnostics.Trace; diff --git a/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs b/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs index 5c758aeb..6ed4ba2a 100644 --- a/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs +++ b/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs @@ -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 diff --git a/Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs b/Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs index cc9d89ae..827ef149 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs @@ -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()); diff --git a/Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs b/Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs index 693150f3..a8ad117a 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs @@ -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()); diff --git a/Src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs b/Src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs index cc68e9d0..2b3d67fe 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs b/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs index d69e5fb5..7ac82731 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs b/Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs index de6facb9..00eba901 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs @@ -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 diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalBase.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalBase.cs index 096a5792..8c1e18b4 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalBase.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalBase.cs @@ -43,13 +43,8 @@ namespace Newtonsoft.Json.Serialization int IEqualityComparer.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 } } diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs index 778e5a46..76578a47 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs index c7f2d466..fc779989 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs @@ -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 diff --git a/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs b/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs index 638c58c4..ebc79511 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs @@ -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> JsonConverterCreatorCache = new ThreadSafeStore>(GetJsonConverterCreator); -#if !(NET20 || NETFX_CORE) +#if !(NET20 || DOTNET) private static readonly ThreadSafeStore AssociatedMetadataTypesCache = new ThreadSafeStore(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(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; diff --git a/Src/Newtonsoft.Json/SerializationBinder.cs b/Src/Newtonsoft.Json/SerializationBinder.cs index 0489ef1e..301d3339 100644 --- a/Src/Newtonsoft.Json/SerializationBinder.cs +++ b/Src/Newtonsoft.Json/SerializationBinder.cs @@ -1,5 +1,5 @@  -#if PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE +#if (DOTNET || PORTABLE40 || PORTABLE) using System; using System.Reflection; diff --git a/Src/Newtonsoft.Json/TraceLevel.cs b/Src/Newtonsoft.Json/TraceLevel.cs index a6244d8e..0d1c3189 100644 --- a/Src/Newtonsoft.Json/TraceLevel.cs +++ b/Src/Newtonsoft.Json/TraceLevel.cs @@ -1,5 +1,5 @@  -#if (NETFX_CORE || PORTABLE40 || PORTABLE) +#if (DOTNET || PORTABLE40 || PORTABLE) using Newtonsoft.Json.Serialization; namespace Newtonsoft.Json diff --git a/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs b/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs index 0ab4fe83..e27d9a13 100644 --- a/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs @@ -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 /// /// 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); diff --git a/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs b/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs index 9f0bb195..f6f9db51 100644 --- a/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs @@ -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) diff --git a/Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs b/Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs index efd14ff4..7533af34 100644 --- a/Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs +++ b/Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs @@ -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 diff --git a/Src/Newtonsoft.Json/Utilities/FSharpUtils.cs b/Src/Newtonsoft.Json/Utilities/FSharpUtils.cs index 13b0ee54..acd938bf 100644 --- a/Src/Newtonsoft.Json/Utilities/FSharpUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/FSharpUtils.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Utilities/ILGeneratorExtensions.cs b/Src/Newtonsoft.Json/Utilities/ILGeneratorExtensions.cs index 30fd02b7..349c0909 100644 --- a/Src/Newtonsoft.Json/Utilities/ILGeneratorExtensions.cs +++ b/Src/Newtonsoft.Json/Utilities/ILGeneratorExtensions.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs index e3a3933d..cf22842a 100644 --- a/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs @@ -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(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 fieldInfos = new List(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(); } -#if !(NETFX_CORE || PORTABLE) +#if !PORTABLE private static void GetChildPrivateFields(IList initialFields, Type targetType, BindingFlags bindingAttr) { // fix weirdness with private FieldInfos only being returned for the current Type diff --git a/Src/Newtonsoft.Json/Utilities/StringUtils.cs b/Src/Newtonsoft.Json/Utilities/StringUtils.cs index 975f1962..236dd23b 100644 --- a/Src/Newtonsoft.Json/Utilities/StringUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/StringUtils.cs @@ -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]); diff --git a/Src/Newtonsoft.Json/Utilities/ThreadSafeStore.cs b/Src/Newtonsoft.Json/Utilities/ThreadSafeStore.cs index d961126a..7181ac5a 100644 --- a/Src/Newtonsoft.Json/Utilities/ThreadSafeStore.cs +++ b/Src/Newtonsoft.Json/Utilities/ThreadSafeStore.cs @@ -78,7 +78,7 @@ namespace Newtonsoft.Json.Utilities Dictionary newStore = new Dictionary(_store); newStore[key] = value; -#if !(NETFX_CORE || PORTABLE) +#if !(DOTNET || PORTABLE) Thread.MemoryBarrier(); #endif _store = newStore; diff --git a/Src/Newtonsoft.Json/Utilities/TypeExtensions.cs b/Src/Newtonsoft.Json/Utilities/TypeExtensions.cs index 3b4d1454..96472ca0 100644 --- a/Src/Newtonsoft.Json/Utilities/TypeExtensions.cs +++ b/Src/Newtonsoft.Json/Utilities/TypeExtensions.cs @@ -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 indexParameters, object placeholder2) { - IList propertyInfos = type.GetProperties(bindingFlags); + IEnumerable propertyInfos = type.GetProperties(bindingFlags); return propertyInfos.Where(p => { @@ -217,10 +221,8 @@ namespace Newtonsoft.Json.Utilities public static IEnumerable 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 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 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 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; diff --git a/Src/Newtonsoft.Json/project.json b/Src/Newtonsoft.Json/project.json new file mode 100644 index 00000000..48b84cff --- /dev/null +++ b/Src/Newtonsoft.Json/project.json @@ -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-*" + } + } + } +} \ No newline at end of file diff --git a/Src/NuGet.Config b/Src/NuGet.Config index 1ca3f8e6..95143bd0 100644 --- a/Src/NuGet.Config +++ b/Src/NuGet.Config @@ -1,7 +1,8 @@  + - + diff --git a/Src/global.json b/Src/global.json new file mode 100644 index 00000000..1039ef51 --- /dev/null +++ b/Src/global.json @@ -0,0 +1,6 @@ +{ + "projects": [ "src" ], + "sdk": { + "version": "1.0.0-beta6" + } +} diff --git a/Tools/PSake/psake.psm1 b/Tools/PSake/psake.psm1 index e5261ff1..74be70c4 100644 --- a/Tools/PSake/psake.psm1 +++ b/Tools/PSake/psake.psm1 @@ -315,7 +315,7 @@ function Invoke-psake { ) try { if (-not $nologo) { - "psake version {0}`nCopyright (c) 2010-2014 James Kovacs & Contributors`n" -f $psake.version + "psake version {0}`nCopyright (c) 2010-2015 James Kovacs, Damian Hickey & Contributors`n" -f $psake.version } if (!$buildFile) { @@ -580,10 +580,15 @@ function ConfigureBuildEnvironment { '4.0' { $versions = @('v4.0.30319') } - '4.5.1' { + {($_ -eq '4.5.1') -or ($_ -eq '4.5.2')} { $versions = @('v4.0.30319') $buildToolsVersions = @('14.0', '12.0') } + '4.6' { + $versions = @('v4.0.30319') + $buildToolsVersions = @('14.0') + } + default { throw ($msgs.error_unknown_framework -f $versionPart, $framework) } @@ -838,7 +843,7 @@ convertfrom-stringdata @' import-localizeddata -bindingvariable msgs -erroraction silentlycontinue $script:psake = @{} -$psake.version = "4.4.1" # contains the current version of psake +$psake.version = "4.4.2" # contains the current version of psake $psake.context = new-object system.collections.stack # holds onto the current state of all variables $psake.run_by_psake_build_tester = $false # indicates that build is being run by psake-BuildTester $psake.config_default = new-object psobject -property @{ @@ -857,4 +862,4 @@ $psake.build_script_dir = "" # contains a string with fully-qualified path to cu LoadConfiguration -export-modulemember -function Invoke-psake, Invoke-Task, Task, Properties, Include, FormatTaskName, TaskSetup, TaskTearDown, Framework, Assert, Exec -variable psake \ No newline at end of file +export-modulemember -function Invoke-psake, Invoke-Task, Task, Properties, Include, FormatTaskName, TaskSetup, TaskTearDown, Framework, Assert, Exec -variable psake