diff --git a/Build/Newtonsoft.Json.nuspec b/Build/Newtonsoft.Json.nuspec index 42f6cea8..8ee8494c 100644 --- a/Build/Newtonsoft.Json.nuspec +++ b/Build/Newtonsoft.Json.nuspec @@ -2,7 +2,7 @@ Newtonsoft.Json - 5.0.8 + 6.0.1-beta1 Json.NET Json.NET is a popular high-performance JSON framework for .NET James Newton-King diff --git a/Build/build.ps1 b/Build/build.ps1 index 2456bf30..633e88c5 100644 --- a/Build/build.ps1 +++ b/Build/build.ps1 @@ -1,7 +1,7 @@ properties { - $zipFileName = "Json50r8.zip" + $zipFileName = "Json60r1.zip" $majorVersion = "4.5" - $majorWithReleaseVersion = "5.0.8" + $majorWithReleaseVersion = "6.0.1" $version = GetVersion $majorWithReleaseVersion $signAssemblies = $false $signKeyPath = "C:\Development\Releases\newtonsoft.snk" @@ -19,7 +19,7 @@ $builds = @( @{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"; Sign=$true}, @{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; Constants="PORTABLE"; FinalDir="Portable"; NuGetDir = "portable-net45+wp80+win8"; Framework="net-4.0"; Sign=$true}, - @{Name = "Newtonsoft.Json.Portable40"; TestsName = "Newtonsoft.Json.Tests.Portable40"; Constants="PORTABLE40"; FinalDir="Portable40"; NuGetDir = "portable-net40+sl4+wp7+win8"; Framework="net-4.0"; Sign=$true}, + @{Name = "Newtonsoft.Json.Portable40"; TestsName = "Newtonsoft.Json.Tests.Portable40"; Constants="PORTABLE40"; FinalDir="Portable40"; NuGetDir = "portable-net40+sl5+wp80+win8+monotouch+monoandroid"; Framework="net-4.0"; Sign=$true}, @{Name = "Newtonsoft.Json.WinRT"; TestsName = $null; Constants="NETFX_CORE"; FinalDir="WinRT"; NuGetDir = "netcore45"; Framework="net-4.5"; Sign=$true}, @{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; Constants="NET40"; FinalDir="Net40"; NuGetDir = "net40"; Framework="net-4.0"; Sign=$true}, @{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; Constants="NET35"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"; Sign=$true}, diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj index e68bf380..f48311e0 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj @@ -102,7 +102,6 @@ 3.5 - 3.5 diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs index ffa2caa4..6a34fb83 100644 --- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs @@ -75,4 +75,4 @@ using System.Security; // by using the '*' as shown below: [assembly: AssemblyVersion("4.5.0.0")] -[assembly: AssemblyFileVersion("5.0.8.16826")] +[assembly: AssemblyFileVersion("6.0.1.16909")] diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs index ff3faa01..917f1f89 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs @@ -9937,6 +9937,20 @@ Parameter name: value", }", s); } #endif + + [Test] + public void RoundtripUriOriginalString() + { + string originalUri = "https://test.com?m=a%2bb"; + + Uri uriWithPlus = new Uri(originalUri); + + string jsonWithPlus = JsonConvert.SerializeObject(uriWithPlus); + + Uri uriWithPlus2 = JsonConvert.DeserializeObject(jsonWithPlus); + + Assert.AreEqual(originalUri, uriWithPlus2.OriginalString); + } } public class PersonReference diff --git a/Src/Newtonsoft.Json/JsonConvert.cs b/Src/Newtonsoft.Json/JsonConvert.cs index 1abc5590..20d60d17 100644 --- a/Src/Newtonsoft.Json/JsonConvert.cs +++ b/Src/Newtonsoft.Json/JsonConvert.cs @@ -397,7 +397,7 @@ namespace Newtonsoft.Json internal static string ToString(Uri value, char quoteChar) { - return ToString(value.ToString(), quoteChar); + return ToString(value.OriginalString, quoteChar); } /// diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index 1c789b29..15f79fe4 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -73,6 +73,15 @@ namespace Newtonsoft.Json.Linq { } + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(decimal value) + : this(value, JTokenType.Float) + { + } + /// /// Initializes a new instance of the class with the given value. /// @@ -119,6 +128,17 @@ namespace Newtonsoft.Json.Linq { } +#if !NET20 + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(DateTimeOffset value) + : this(value, JTokenType.Date) + { + } +#endif + /// /// Initializes a new instance of the class with the given value. /// diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs index 30769750..08253f81 100644 --- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -91,5 +91,5 @@ using System.Security; // by using the '*' as shown below: [assembly: AssemblyVersion("4.5.0.0")] -[assembly: AssemblyFileVersion("5.0.8.16826")] +[assembly: AssemblyFileVersion("6.0.1.16909")] [assembly: CLSCompliant(true)] diff --git a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs index b5fac9ed..777b0abf 100644 --- a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs +++ b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs @@ -143,9 +143,10 @@ namespace Newtonsoft.Json.Serialization /// Gets or sets the default members search flags. /// /// The default members search flags. + [ObsoleteAttribute("DefaultMembersSearchFlags is obsolete. 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 = BindingFlags.Instance | BindingFlags.Public; #endif /// @@ -194,7 +195,9 @@ namespace Newtonsoft.Json.Serialization public DefaultContractResolver(bool shareCache) { #if !NETFX_CORE +#pragma warning disable 618 DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.Instance; +#pragma warning restore 618 #endif #if !(NETFX_CORE || PORTABLE || PORTABLE40) IgnoreSerializableAttribute = true; @@ -280,8 +283,10 @@ namespace Newtonsoft.Json.Serialization DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(objectType); #endif +#pragma warning disable 618 List defaultMembers = ReflectionUtils.GetFieldsAndProperties(objectType, DefaultMembersSearchFlags) .Where(m => !ReflectionUtils.IsIndexedProperty(m)).ToList(); +#pragma warning restore 618 foreach (MemberInfo member in allMembers) { @@ -1248,8 +1253,10 @@ namespace Newtonsoft.Json.Serialization property.ItemTypeNameHandling = (propertyAttribute != null) ? propertyAttribute._itemTypeNameHandling : null; allowNonPublicAccess = false; +#pragma warning disable 618 if ((DefaultMembersSearchFlags & BindingFlags.NonPublic) == BindingFlags.NonPublic) allowNonPublicAccess = true; +#pragma warning restore 618 if (propertyAttribute != null) allowNonPublicAccess = true; if (memberSerialization == MemberSerialization.Fields)