This repository was archived by the owner on Apr 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
Microsoft.DotNet.Cli.Utils
dotnet/commands/dotnet-add/dotnet-add-package Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 11// Copyright (c) .NET Foundation and contributors. All rights reserved.
22// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3-
3+
4+ using Newtonsoft . Json ;
45using Newtonsoft . Json . Linq ;
5- using System . IO ;
6+ using System . IO ;
67
78namespace Microsoft . DotNet . Cli . Utils
89{
@@ -32,8 +33,10 @@ public static bool IsApplicationPortable(string entryAssemblyPath)
3233 }
3334
3435 private JObject OpenRuntimeConfig ( string runtimeConfigPath )
35- {
36- return JObject . Parse ( File . ReadAllText ( runtimeConfigPath ) ) ;
36+ {
37+ var reader = new JsonTextReader ( new StringReader ( File . ReadAllText ( runtimeConfigPath ) ) ) ;
38+
39+ return JObject . Load ( reader ) ;
3740 }
3841
3942 private RuntimeConfigFramework ParseFramework ( JObject runtimeConfigRoot )
Original file line number Diff line number Diff line change 33
44using System ;
55using System . Collections . Generic ;
6+ using System . IO ;
67using System . Linq ;
78using System . Net . Http ;
89using System . Threading ;
910using Microsoft . DotNet . Cli . CommandLine ;
11+ using Newtonsoft . Json ;
1012using Newtonsoft . Json . Linq ;
1113using LocalizableStrings = Microsoft . DotNet . Tools . Add . PackageReference . LocalizableStrings ;
1214
@@ -67,11 +69,14 @@ public static IEnumerable<string> QueryNuGet(string match)
6769 yield break ;
6870 }
6971
70- var json = JObject . Parse ( result ) ;
71-
72- foreach ( var id in json [ "data" ] )
72+ using ( var reader = new JsonTextReader ( new StringReader ( result ) ) )
7373 {
74- yield return id [ "id" ] . Value < string > ( ) ;
74+ var json = JObject . Load ( reader ) ;
75+
76+ foreach ( var id in json [ "data" ] )
77+ {
78+ yield return id [ "id" ] . Value < string > ( ) ;
79+ }
7580 }
7681 }
7782 }
You can’t perform that action at this time.
0 commit comments