From 35d3f2b7e2568ae39d030c6098c5806a7d89b719 Mon Sep 17 00:00:00 2001
From: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date: Mon, 11 Jul 2022 16:18:03 +0300
Subject: [PATCH] Consolidate Newtonsoft versions (#71402)
* Consolidate Newtonsoft versions
* Set JsonTextReader's MaxDepth to null
In v13, defaults are changed from null to 64.
* Revert NetCoreServer used by xharness
---
eng/Versions.props | 3 ++-
.../HostApiInvokerApp/HostApiInvokerApp.csproj | 2 +-
.../Assets/TestProjects/LightupLib/LightupLib.csproj | 2 +-
.../Assets/TestProjects/PortableApp/PortableApp.csproj | 2 +-
.../PortableTestApp/PortableTestApp.csproj | 2 +-
.../SharedFxLookupPortableApp.csproj | 2 +-
.../TestProjects/StandaloneApp/StandaloneApp.csproj | 2 +-
.../StandaloneApp20/StandaloneApp20.csproj | 2 +-
.../StandaloneApp21/StandaloneApp21.csproj | 2 +-
.../StandaloneTestApp/StandaloneTestApp.csproj | 2 +-
.../StartupHookWithDependency.csproj | 2 +-
.../tests/Assets/TestUtils/TestProjects.props | 4 +++-
.../ResolveComponentDependencies.cs | 4 ++--
.../ClsidMapTests.cs | 4 ++--
src/installer/tests/TestUtils/RuntimeConfig.cs | 2 +-
src/installer/tests/TestUtils/TestUtils.csproj | 2 +-
.../tests/DependencyContextJsonWriterTests.cs | 2 +-
.../src/GenerateRuntimeGraph.cs | 2 +-
.../tests/System.Text.Json.Tests/JsonDocumentTests.cs | 4 ++--
.../tests/System.Text.Json.Tests/JsonTestHelper.cs | 10 +++++-----
.../Utf8JsonReaderTests.TryGet.cs | 2 +-
.../BrowserDebugProxy/BrowserDebugProxy.csproj | 2 +-
src/tests/Common/external/external.csproj | 4 ++--
src/tests/ilverify/ILVerificationTests.csproj | 2 +-
24 files changed, 35 insertions(+), 32 deletions(-)
diff --git a/eng/Versions.props b/eng/Versions.props
index 9c3905672b4..30dff6f3864 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -158,7 +158,8 @@
0.12.0-pre.20
2.4.5
3.1.2
- 12.0.3
+ 13.0.1
+ 1.0.2
2.0.4
4.12.0
2.14.3
diff --git a/src/installer/tests/Assets/TestProjects/HostApiInvokerApp/HostApiInvokerApp.csproj b/src/installer/tests/Assets/TestProjects/HostApiInvokerApp/HostApiInvokerApp.csproj
index 570b3efa794..087d0c77a53 100644
--- a/src/installer/tests/Assets/TestProjects/HostApiInvokerApp/HostApiInvokerApp.csproj
+++ b/src/installer/tests/Assets/TestProjects/HostApiInvokerApp/HostApiInvokerApp.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestProjects/LightupLib/LightupLib.csproj b/src/installer/tests/Assets/TestProjects/LightupLib/LightupLib.csproj
index e7fb1c6a065..976a8423304 100644
--- a/src/installer/tests/Assets/TestProjects/LightupLib/LightupLib.csproj
+++ b/src/installer/tests/Assets/TestProjects/LightupLib/LightupLib.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestProjects/PortableApp/PortableApp.csproj b/src/installer/tests/Assets/TestProjects/PortableApp/PortableApp.csproj
index 0a72b6bc1fc..96f7d139662 100644
--- a/src/installer/tests/Assets/TestProjects/PortableApp/PortableApp.csproj
+++ b/src/installer/tests/Assets/TestProjects/PortableApp/PortableApp.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj b/src/installer/tests/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj
index 26b183bbec0..bfad7e21bea 100644
--- a/src/installer/tests/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj
+++ b/src/installer/tests/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestProjects/SharedFxLookupPortableApp/SharedFxLookupPortableApp.csproj b/src/installer/tests/Assets/TestProjects/SharedFxLookupPortableApp/SharedFxLookupPortableApp.csproj
index e1f97d2216d..9cf6012fd61 100644
--- a/src/installer/tests/Assets/TestProjects/SharedFxLookupPortableApp/SharedFxLookupPortableApp.csproj
+++ b/src/installer/tests/Assets/TestProjects/SharedFxLookupPortableApp/SharedFxLookupPortableApp.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestProjects/StandaloneApp/StandaloneApp.csproj b/src/installer/tests/Assets/TestProjects/StandaloneApp/StandaloneApp.csproj
index 0846750fb7c..0e51cdb190b 100644
--- a/src/installer/tests/Assets/TestProjects/StandaloneApp/StandaloneApp.csproj
+++ b/src/installer/tests/Assets/TestProjects/StandaloneApp/StandaloneApp.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestProjects/StandaloneApp20/StandaloneApp20.csproj b/src/installer/tests/Assets/TestProjects/StandaloneApp20/StandaloneApp20.csproj
index 14513b05b71..19ee347ce0f 100644
--- a/src/installer/tests/Assets/TestProjects/StandaloneApp20/StandaloneApp20.csproj
+++ b/src/installer/tests/Assets/TestProjects/StandaloneApp20/StandaloneApp20.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestProjects/StandaloneApp21/StandaloneApp21.csproj b/src/installer/tests/Assets/TestProjects/StandaloneApp21/StandaloneApp21.csproj
index c8593050181..abc14d18be4 100644
--- a/src/installer/tests/Assets/TestProjects/StandaloneApp21/StandaloneApp21.csproj
+++ b/src/installer/tests/Assets/TestProjects/StandaloneApp21/StandaloneApp21.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj b/src/installer/tests/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj
index 42bc4348e5d..f06537cca75 100644
--- a/src/installer/tests/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj
+++ b/src/installer/tests/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestProjects/StartupHookWithDependency/StartupHookWithDependency.csproj b/src/installer/tests/Assets/TestProjects/StartupHookWithDependency/StartupHookWithDependency.csproj
index cc51ff2471c..48714afea7d 100644
--- a/src/installer/tests/Assets/TestProjects/StartupHookWithDependency/StartupHookWithDependency.csproj
+++ b/src/installer/tests/Assets/TestProjects/StartupHookWithDependency/StartupHookWithDependency.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/src/installer/tests/Assets/TestUtils/TestProjects.props b/src/installer/tests/Assets/TestUtils/TestProjects.props
index 3f595ca7026..33ab2ba4f03 100644
--- a/src/installer/tests/Assets/TestUtils/TestProjects.props
+++ b/src/installer/tests/Assets/TestUtils/TestProjects.props
@@ -13,5 +13,7 @@
win-x86 tests that assumed a win-x64 app host RID based on the runner SDK.
-->
$(TestTargetRid)
+
+ 13.0.1
-
\ No newline at end of file
+
diff --git a/src/installer/tests/HostActivation.Tests/DependencyResolution/ResolveComponentDependencies.cs b/src/installer/tests/HostActivation.Tests/DependencyResolution/ResolveComponentDependencies.cs
index 33f248b546e..1ecdc674f0f 100644
--- a/src/installer/tests/HostActivation.Tests/DependencyResolution/ResolveComponentDependencies.cs
+++ b/src/installer/tests/HostActivation.Tests/DependencyResolution/ResolveComponentDependencies.cs
@@ -449,9 +449,9 @@ public TestApp CreateComponentWithDependencies(Action customi
NetCoreAppBuilder builder = NetCoreAppBuilder.PortableForNETCoreApp(componentWithDependencies)
.WithProject(p => p.WithAssemblyGroup(null, g => g.WithMainAssembly()))
.WithProject("ComponentDependency", "1.0.0", p => p.WithAssemblyGroup(null, g => g.WithAsset("ComponentDependency.dll")))
- .WithPackage("Newtonsoft.Json", "9.0.1", p => p.WithAssemblyGroup(null, g => g
+ .WithPackage("Newtonsoft.Json", "13.0.1", p => p.WithAssemblyGroup(null, g => g
.WithAsset("lib/netstandard1.0/Newtonsoft.Json.dll", f => f
- .WithVersion("9.0.0.0", "9.0.1.19813")
+ .WithVersion("13.0.0.0", "13.0.1.25517")
.WithFileOnDiskPath("Newtonsoft.Json.dll"))))
.WithPackage("Libuv", "1.9.1", p => p
.WithNativeLibraryGroup("debian-x64", g => g.WithAsset("runtimes/debian-x64/native/libuv.so"))
diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/ClsidMapTests.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/ClsidMapTests.cs
index 649b34c500b..8b496c191f2 100644
--- a/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/ClsidMapTests.cs
+++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/ClsidMapTests.cs
@@ -20,7 +20,7 @@ public class ClsidMapTests : IClassFixture
public ClsidMapTests(SharedTestState fixture)
{
- sharedTestState = fixture;
+ sharedTestState = fixture;
}
[Fact]
@@ -122,7 +122,7 @@ private JObject CreateClsidMap(TestProjectFixture project)
}
using (var clsidMapFile = File.OpenText(clsidMapPath))
- using (var clsidMapReader = new JsonTextReader(clsidMapFile))
+ using (var clsidMapReader = new JsonTextReader(clsidMapFile) { MaxDepth = null })
{
return JObject.Load(clsidMapReader);
}
diff --git a/src/installer/tests/TestUtils/RuntimeConfig.cs b/src/installer/tests/TestUtils/RuntimeConfig.cs
index 809a5c9d09b..b4abe04cdbc 100644
--- a/src/installer/tests/TestUtils/RuntimeConfig.cs
+++ b/src/installer/tests/TestUtils/RuntimeConfig.cs
@@ -121,7 +121,7 @@ public static RuntimeConfig FromFile(string path)
if (File.Exists(path))
{
using (TextReader textReader = File.OpenText(path))
- using (JsonTextReader reader = new JsonTextReader(textReader))
+ using (var reader = new JsonTextReader(textReader) { MaxDepth = null })
{
JObject root = (JObject)JToken.ReadFrom(reader);
JObject runtimeOptions = (JObject)root["runtimeOptions"];
diff --git a/src/installer/tests/TestUtils/TestUtils.csproj b/src/installer/tests/TestUtils/TestUtils.csproj
index f22b1c71a60..8b3aa595237 100644
--- a/src/installer/tests/TestUtils/TestUtils.csproj
+++ b/src/installer/tests/TestUtils/TestUtils.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/src/libraries/Microsoft.Extensions.DependencyModel/tests/DependencyContextJsonWriterTests.cs b/src/libraries/Microsoft.Extensions.DependencyModel/tests/DependencyContextJsonWriterTests.cs
index c17a7dc085b..48f8deebe99 100644
--- a/src/libraries/Microsoft.Extensions.DependencyModel/tests/DependencyContextJsonWriterTests.cs
+++ b/src/libraries/Microsoft.Extensions.DependencyModel/tests/DependencyContextJsonWriterTests.cs
@@ -24,7 +24,7 @@ public JObject Save(DependencyContext dependencyContext)
{
using (var textReader = new StreamReader(readStream))
{
- using (var reader = new JsonTextReader(textReader))
+ using (var reader = new JsonTextReader(textReader) { MaxDepth = null })
{
return JObject.Load(reader);
}
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs b/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs
index 263b437bd8e..8ecc4c2deea 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs
@@ -344,7 +344,7 @@ private void AddRuntimeIdentifiers(ICollection runtimeGroups)
{
var serializer = new JsonSerializer();
using (var file = File.OpenText(mapFile))
- using (var jsonTextReader = new JsonTextReader(file))
+ using (var jsonTextReader = new JsonTextReader(file) { MaxDepth = null })
{
return serializer.Deserialize>>(jsonTextReader);
}
diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs
index 9b92c9ae365..45590069c09 100644
--- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs
+++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs
@@ -553,7 +553,7 @@ public static async Task ParseJson_SequenceBytes_Multi(bool compactData, TestCas
using (var stream = new MemoryStream(dataUtf8))
using (var streamReader = new StreamReader(stream, Encoding.UTF8, false, 1024, true))
- using (JsonTextReader jsonReader = new JsonTextReader(streamReader))
+ using (var jsonReader = new JsonTextReader(streamReader) { MaxDepth = null })
{
JToken jToken = JToken.ReadFrom(jsonReader);
@@ -3656,7 +3656,7 @@ private static string GetCompactJson(TestCaseType testCaseType, string jsonStrin
return existing;
}
- using (JsonTextReader jsonReader = new JsonTextReader(new StringReader(jsonString)))
+ using (var jsonReader = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null })
{
jsonReader.FloatParseHandling = FloatParseHandling.Decimal;
JToken jtoken = JToken.ReadFrom(jsonReader);
diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs
index 1c0302727df..90d6dbca7be 100644
--- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs
+++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs
@@ -28,7 +28,7 @@ internal static partial class JsonTestHelper
public static string NewtonsoftReturnStringHelper(TextReader reader)
{
var sb = new StringBuilder();
- var json = new JsonTextReader(reader);
+ var json = new JsonTextReader(reader) { MaxDepth = null };
while (json.Read())
{
if (json.Value != null)
@@ -358,7 +358,7 @@ public static string InsertCommentsEverywhere(string jsonString)
{
writer.Formatting = Formatting.Indented;
- var newtonsoft = new JsonTextReader(new StringReader(jsonString));
+ var newtonsoft = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null };
writer.WriteComment("comment");
while (newtonsoft.Read())
{
@@ -372,7 +372,7 @@ public static string InsertCommentsEverywhere(string jsonString)
public static List GetTokenTypes(string jsonString)
{
- var newtonsoft = new JsonTextReader(new StringReader(jsonString));
+ var newtonsoft = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null };
int totalReads = 0;
while (newtonsoft.Read())
{
@@ -383,7 +383,7 @@ public static List GetTokenTypes(string jsonString)
for (int i = 0; i < totalReads; i++)
{
- newtonsoft = new JsonTextReader(new StringReader(jsonString));
+ newtonsoft = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null };
for (int j = 0; j < i; j++)
{
Assert.True(newtonsoft.Read());
@@ -703,7 +703,7 @@ public static decimal NextDecimal(Random random, double minValue, double maxValu
public static string GetCompactString(string jsonString)
{
- using (JsonTextReader jsonReader = new JsonTextReader(new StringReader(jsonString)))
+ using (var jsonReader = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null })
{
jsonReader.FloatParseHandling = FloatParseHandling.Decimal;
JToken jtoken = JToken.ReadFrom(jsonReader);
diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs
index 15793c465fc..9ae890d3539 100644
--- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs
+++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs
@@ -1026,7 +1026,7 @@ public static void TestingGetString(string jsonString)
var expectedPropertyNames = new List();
var expectedValues = new List();
- var jsonNewtonsoft = new JsonTextReader(new StringReader(jsonString));
+ var jsonNewtonsoft = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null };
while (jsonNewtonsoft.Read())
{
if (jsonNewtonsoft.TokenType == JsonToken.String)
diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/BrowserDebugProxy.csproj b/src/mono/wasm/debugger/BrowserDebugProxy/BrowserDebugProxy.csproj
index 5e188c3172b..c05515cdd10 100644
--- a/src/mono/wasm/debugger/BrowserDebugProxy/BrowserDebugProxy.csproj
+++ b/src/mono/wasm/debugger/BrowserDebugProxy/BrowserDebugProxy.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/src/tests/Common/external/external.csproj b/src/tests/Common/external/external.csproj
index 4d6f87eb571..1e4242242ea 100644
--- a/src/tests/Common/external/external.csproj
+++ b/src/tests/Common/external/external.csproj
@@ -68,8 +68,8 @@
-
-
+
+
diff --git a/src/tests/ilverify/ILVerificationTests.csproj b/src/tests/ilverify/ILVerificationTests.csproj
index fce08babfde..3144da43d0c 100644
--- a/src/tests/ilverify/ILVerificationTests.csproj
+++ b/src/tests/ilverify/ILVerificationTests.csproj
@@ -16,7 +16,7 @@
-
+
--
GitLab