-Fixed potential inifinite loop when parsing unquoted value
-Added NuGet install.ps1 -Incremented version to 5.0.6
This commit is contained in:
@@ -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.5</version>
|
<version>5.0.6</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>
|
||||||
|
|||||||
+9
-5
@@ -1,12 +1,12 @@
|
|||||||
properties {
|
properties {
|
||||||
$zipFileName = "Json50r5.zip"
|
$zipFileName = "Json50r6.zip"
|
||||||
$majorVersion = "4.5"
|
$majorVersion = "4.5"
|
||||||
$majorWithReleaseVersion = "5.0.5"
|
$majorWithReleaseVersion = "5.0.6"
|
||||||
$version = GetVersion $majorWithReleaseVersion
|
$version = GetVersion $majorWithReleaseVersion
|
||||||
$signAssemblies = $false
|
$signAssemblies = $false
|
||||||
$signKeyPath = "D:\Development\Releases\newtonsoft.snk"
|
$signKeyPath = "D:\Development\Releases\newtonsoft.snk"
|
||||||
$buildDocumentation = $false
|
$buildDocumentation = $false
|
||||||
$buildNuGet = $false
|
$buildNuGet = $true
|
||||||
$treatWarningsAsErrors = $false
|
$treatWarningsAsErrors = $false
|
||||||
|
|
||||||
$baseDir = resolve-path ..
|
$baseDir = resolve-path ..
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
$releaseDir = "$baseDir\Release"
|
$releaseDir = "$baseDir\Release"
|
||||||
$workingDir = "$baseDir\Working"
|
$workingDir = "$baseDir\Working"
|
||||||
$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+sl4+wp7+win8"; 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},
|
||||||
@@ -77,11 +77,15 @@ task Package -depends Build {
|
|||||||
if ($buildNuGet)
|
if ($buildNuGet)
|
||||||
{
|
{
|
||||||
New-Item -Path $workingDir\NuGet -ItemType Directory
|
New-Item -Path $workingDir\NuGet -ItemType Directory
|
||||||
|
New-Item -Path $workingDir\NuGet\tools -ItemType Directory
|
||||||
|
|
||||||
Copy-Item -Path "$buildDir\Newtonsoft.Json.nuspec" -Destination $workingDir\NuGet\Newtonsoft.Json.nuspec -recurse
|
Copy-Item -Path "$buildDir\Newtonsoft.Json.nuspec" -Destination $workingDir\NuGet\Newtonsoft.Json.nuspec -recurse
|
||||||
|
|
||||||
|
Copy-Item -Path "$buildDir\install.ps1" -Destination $workingDir\NuGet\tools\install.ps1 -recurse
|
||||||
|
|
||||||
foreach ($build in $builds)
|
foreach ($build in $builds)
|
||||||
{
|
{
|
||||||
if ($build.NuGetDir -ne $null)
|
if ($build.NuGetDir)
|
||||||
{
|
{
|
||||||
$name = $build.TestsName
|
$name = $build.TestsName
|
||||||
$finalDir = $build.FinalDir
|
$finalDir = $build.FinalDir
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
param($installPath, $toolsPath, $package, $project)
|
||||||
|
|
||||||
|
# yolo
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$url = "http://www.json.net"
|
||||||
|
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
|
||||||
|
|
||||||
|
if ($dte2.ActiveWindow.Caption -eq "Package Manager Console")
|
||||||
|
{
|
||||||
|
# user is installing from VS NuGet console
|
||||||
|
# get reference to the window, the console host and the input history
|
||||||
|
# show webpage if "install-package newtonsoft.json" was last input
|
||||||
|
|
||||||
|
$consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow])
|
||||||
|
|
||||||
|
$props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor `
|
||||||
|
[System.Reflection.BindingFlags]::NonPublic)
|
||||||
|
|
||||||
|
$prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1
|
||||||
|
if ($prop -eq $null) { return }
|
||||||
|
|
||||||
|
$hostInfo = $prop.GetValue($consoleWindow)
|
||||||
|
if ($hostInfo -eq $null) { return }
|
||||||
|
|
||||||
|
$history = $hostInfo.WpfConsole.InputHistory.History
|
||||||
|
|
||||||
|
$lastCommand = $history | select -last 1
|
||||||
|
|
||||||
|
if ($lastCommand)
|
||||||
|
{
|
||||||
|
$lastCommand = $lastCommand.Trim().ToLower()
|
||||||
|
if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json"))
|
||||||
|
{
|
||||||
|
$dte2.ItemOperations.Navigate($url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# user is installing from VS NuGet dialog
|
||||||
|
# get reference to the window, then smart output console provider
|
||||||
|
# show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation
|
||||||
|
|
||||||
|
$instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor `
|
||||||
|
[System.Reflection.BindingFlags]::NonPublic)
|
||||||
|
$consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor `
|
||||||
|
[System.Reflection.BindingFlags]::NonPublic)
|
||||||
|
if ($instanceField -eq $null -or $consoleField -eq $null) { return }
|
||||||
|
|
||||||
|
$instance = $instanceField.GetValue($null)
|
||||||
|
if ($instance -eq $null) { return }
|
||||||
|
|
||||||
|
$consoleProvider = $consoleField.GetValue($instance)
|
||||||
|
if ($consoleProvider -eq $null) { return }
|
||||||
|
|
||||||
|
$console = $consoleProvider.CreateOutputConsole($false)
|
||||||
|
|
||||||
|
$messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor `
|
||||||
|
[System.Reflection.BindingFlags]::NonPublic)
|
||||||
|
if ($messagesField -eq $null) { return }
|
||||||
|
|
||||||
|
$messages = $messagesField.GetValue($console)
|
||||||
|
if ($messages -eq $null) { return }
|
||||||
|
|
||||||
|
$operations = $messages -split "=============================="
|
||||||
|
|
||||||
|
# second to last
|
||||||
|
$lastOperation = $operations | select -last 2 | select -first 1
|
||||||
|
|
||||||
|
if ($lastOperation)
|
||||||
|
{
|
||||||
|
$lastOperation = $lastOperation.ToLower()
|
||||||
|
|
||||||
|
$lines = $lastOperation -split "`r`n"
|
||||||
|
|
||||||
|
$installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json") } | select -first 1
|
||||||
|
|
||||||
|
if ($installMatch)
|
||||||
|
{
|
||||||
|
$dte2.ItemOperations.Navigate($url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
# prevent potental errors from bubbling up
|
||||||
|
}
|
||||||
@@ -47,6 +47,32 @@ namespace Newtonsoft.Json.Tests
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class JsonTextReaderTest : TestFixtureBase
|
public class JsonTextReaderTest : TestFixtureBase
|
||||||
{
|
{
|
||||||
|
[Test]
|
||||||
|
public void ThrowErrorWhenParsingUnquoteStringThatStartsWithNE()
|
||||||
|
{
|
||||||
|
const string json = @"{ ""ItemName"": ""value"", ""u"":netanelsalinger,""r"":9 }";
|
||||||
|
|
||||||
|
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||||
|
|
||||||
|
Assert.IsTrue(reader.Read());
|
||||||
|
Assert.AreEqual(JsonToken.StartObject, reader.TokenType);
|
||||||
|
|
||||||
|
Assert.IsTrue(reader.Read());
|
||||||
|
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
|
||||||
|
|
||||||
|
Assert.IsTrue(reader.Read());
|
||||||
|
Assert.AreEqual(JsonToken.String, reader.TokenType);
|
||||||
|
|
||||||
|
Assert.IsTrue(reader.Read());
|
||||||
|
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
|
||||||
|
|
||||||
|
ExceptionAssert.Throws<JsonReaderException>("Unexpected content while parsing JSON. Path 'u', line 1, position 27.",
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void FloatParseHandling()
|
public void FloatParseHandling()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,17 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class LinqToJsonTest : TestFixtureBase
|
public class LinqToJsonTest : TestFixtureBase
|
||||||
{
|
{
|
||||||
|
[Test]
|
||||||
|
public void ForEach()
|
||||||
|
{
|
||||||
|
JArray items = new JArray(new JObject(new JProperty("name", "value!")));
|
||||||
|
|
||||||
|
foreach (JObject friend in items)
|
||||||
|
{
|
||||||
|
Console.WriteLine(friend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DoubleValue()
|
public void DoubleValue()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,4 +75,4 @@ using System.Security;
|
|||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// 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.5.16124")]
|
[assembly: AssemblyFileVersion("5.0.6.16201")]
|
||||||
|
|||||||
@@ -1150,6 +1150,10 @@ namespace Newtonsoft.Json
|
|||||||
|
|
||||||
SetToken(JsonToken.StartConstructor, constructorName);
|
SetToken(JsonToken.StartConstructor, constructorName);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw JsonReaderException.Create(this, "Unexpected content while parsing JSON.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseNumber()
|
private void ParseNumber()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>9.0.30729</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}</ProjectGuid>
|
<ProjectGuid>{B70AD007-4437-44C2-A25A-6D5AE41691F9}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Newtonsoft.Json</RootNamespace>
|
<RootNamespace>Newtonsoft.Json</RootNamespace>
|
||||||
|
|||||||
@@ -92,6 +92,6 @@ using System.Security;
|
|||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// 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.5.16124")]
|
[assembly: AssemblyFileVersion("5.0.6.16201")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(true)]
|
[assembly: CLSCompliant(true)]
|
||||||
|
|||||||
Reference in New Issue
Block a user