-Incremented version to 6.0.1

-Changed .NET 4 Portable NuGet target to portable-net40+sl5+wp80+win8+monotouch+monoandroid
-Fixed Uri serialization roundtrip by using Uri.OriginalString
-Added Decimal and DateTimeOffset constructors to JValue
-Changed DefaultMemberSearchFlags on DefaultContractResolver to obsolete
This commit is contained in:
James Newton-King
2014-01-09 22:01:10 +13:00
parent 62f6a2c256
commit f878541047
9 changed files with 49 additions and 9 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>Newtonsoft.Json</id> <id>Newtonsoft.Json</id>
<version>5.0.8</version> <version>6.0.1-beta1</version>
<title>Json.NET</title> <title>Json.NET</title>
<description>Json.NET is a popular high-performance JSON framework for .NET</description> <description>Json.NET is a popular high-performance JSON framework for .NET</description>
<authors>James Newton-King</authors> <authors>James Newton-King</authors>
+3 -3
View File
@@ -1,7 +1,7 @@
properties { properties {
$zipFileName = "Json50r8.zip" $zipFileName = "Json60r1.zip"
$majorVersion = "4.5" $majorVersion = "4.5"
$majorWithReleaseVersion = "5.0.8" $majorWithReleaseVersion = "6.0.1"
$version = GetVersion $majorWithReleaseVersion $version = GetVersion $majorWithReleaseVersion
$signAssemblies = $false $signAssemblies = $false
$signKeyPath = "C:\Development\Releases\newtonsoft.snk" $signKeyPath = "C:\Development\Releases\newtonsoft.snk"
@@ -19,7 +19,7 @@
$builds = @( $builds = @(
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"; Sign=$true}, @{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.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.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.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}, @{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; Constants="NET35"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"; Sign=$true},
@@ -102,7 +102,6 @@
<Reference Include="System.Web.Extensions"> <Reference Include="System.Web.Extensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
<Reference Include="System.Windows" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq"> <Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -75,4 +75,4 @@ using System.Security;
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("4.5.0.0")] [assembly: AssemblyVersion("4.5.0.0")]
[assembly: AssemblyFileVersion("5.0.8.16826")] [assembly: AssemblyFileVersion("6.0.1.16909")]
@@ -9937,6 +9937,20 @@ Parameter name: value",
}", s); }", s);
} }
#endif #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<Uri>(jsonWithPlus);
Assert.AreEqual(originalUri, uriWithPlus2.OriginalString);
}
} }
public class PersonReference public class PersonReference
+1 -1
View File
@@ -397,7 +397,7 @@ namespace Newtonsoft.Json
internal static string ToString(Uri value, char quoteChar) internal static string ToString(Uri value, char quoteChar)
{ {
return ToString(value.ToString(), quoteChar); return ToString(value.OriginalString, quoteChar);
} }
/// <summary> /// <summary>
+20
View File
@@ -73,6 +73,15 @@ namespace Newtonsoft.Json.Linq
{ {
} }
/// <summary>
/// Initializes a new instance of the <see cref="JValue"/> class with the given value.
/// </summary>
/// <param name="value">The value.</param>
public JValue(decimal value)
: this(value, JTokenType.Float)
{
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JValue"/> class with the given value. /// Initializes a new instance of the <see cref="JValue"/> class with the given value.
/// </summary> /// </summary>
@@ -119,6 +128,17 @@ namespace Newtonsoft.Json.Linq
{ {
} }
#if !NET20
/// <summary>
/// Initializes a new instance of the <see cref="JValue"/> class with the given value.
/// </summary>
/// <param name="value">The value.</param>
public JValue(DateTimeOffset value)
: this(value, JTokenType.Date)
{
}
#endif
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JValue"/> class with the given value. /// Initializes a new instance of the <see cref="JValue"/> class with the given value.
/// </summary> /// </summary>
@@ -91,5 +91,5 @@ using System.Security;
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("4.5.0.0")] [assembly: AssemblyVersion("4.5.0.0")]
[assembly: AssemblyFileVersion("5.0.8.16826")] [assembly: AssemblyFileVersion("6.0.1.16909")]
[assembly: CLSCompliant(true)] [assembly: CLSCompliant(true)]
@@ -143,9 +143,10 @@ namespace Newtonsoft.Json.Serialization
/// Gets or sets the default members search flags. /// Gets or sets the default members search flags.
/// </summary> /// </summary>
/// <value>The default members search flags.</value> /// <value>The default members search flags.</value>
[ObsoleteAttribute("DefaultMembersSearchFlags is obsolete. Inherit from DefaultContractResolver and override the GetSerializableMembers method instead.")]
public BindingFlags DefaultMembersSearchFlags { get; set; } public BindingFlags DefaultMembersSearchFlags { get; set; }
#else #else
private BindingFlags DefaultMembersSearchFlags = BindingFlags.Instance | BindingFlags.Public; private BindingFlags DefaultMembersSearchFlags = BindingFlags.Instance | BindingFlags.Public;
#endif #endif
/// <summary> /// <summary>
@@ -194,7 +195,9 @@ namespace Newtonsoft.Json.Serialization
public DefaultContractResolver(bool shareCache) public DefaultContractResolver(bool shareCache)
{ {
#if !NETFX_CORE #if !NETFX_CORE
#pragma warning disable 618
DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.Instance; DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.Instance;
#pragma warning restore 618
#endif #endif
#if !(NETFX_CORE || PORTABLE || PORTABLE40) #if !(NETFX_CORE || PORTABLE || PORTABLE40)
IgnoreSerializableAttribute = true; IgnoreSerializableAttribute = true;
@@ -280,8 +283,10 @@ namespace Newtonsoft.Json.Serialization
DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(objectType); DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(objectType);
#endif #endif
#pragma warning disable 618
List<MemberInfo> defaultMembers = ReflectionUtils.GetFieldsAndProperties(objectType, DefaultMembersSearchFlags) List<MemberInfo> defaultMembers = ReflectionUtils.GetFieldsAndProperties(objectType, DefaultMembersSearchFlags)
.Where(m => !ReflectionUtils.IsIndexedProperty(m)).ToList(); .Where(m => !ReflectionUtils.IsIndexedProperty(m)).ToList();
#pragma warning restore 618
foreach (MemberInfo member in allMembers) foreach (MemberInfo member in allMembers)
{ {
@@ -1248,8 +1253,10 @@ namespace Newtonsoft.Json.Serialization
property.ItemTypeNameHandling = (propertyAttribute != null) ? propertyAttribute._itemTypeNameHandling : null; property.ItemTypeNameHandling = (propertyAttribute != null) ? propertyAttribute._itemTypeNameHandling : null;
allowNonPublicAccess = false; allowNonPublicAccess = false;
#pragma warning disable 618
if ((DefaultMembersSearchFlags & BindingFlags.NonPublic) == BindingFlags.NonPublic) if ((DefaultMembersSearchFlags & BindingFlags.NonPublic) == BindingFlags.NonPublic)
allowNonPublicAccess = true; allowNonPublicAccess = true;
#pragma warning restore 618
if (propertyAttribute != null) if (propertyAttribute != null)
allowNonPublicAccess = true; allowNonPublicAccess = true;
if (memberSerialization == MemberSerialization.Fields) if (memberSerialization == MemberSerialization.Fields)