From 77010cdccb1308eb79c5c55209c061aa932fbdba Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Fri, 26 Jul 2024 01:33:14 +0300 Subject: [PATCH] [dotnet] Migration from `Newtonsoft.Json` to `System.Text.Json` package (#14292) --- MODULE.bazel | 2 +- dotnet/paket.dependencies | 2 +- dotnet/paket.lock | 23 ++-- dotnet/paket.nuget.bzl | 4 +- dotnet/src/support/BUILD.bazel | 7 +- dotnet/src/webdriver/BUILD.bazel | 76 +++++++++-- .../Chromium/ChromiumNetworkConditions.cs | 14 +- dotnet/src/webdriver/Command.cs | 18 ++- dotnet/src/webdriver/Cookie.cs | 25 ++-- .../webdriver/DevTools/DevToolsCommandData.cs | 21 +-- .../src/webdriver/DevTools/DevToolsSession.cs | 50 +++---- .../DevToolsSessionEventReceivedEventArgs.cs | 6 +- .../webdriver/DevTools/DevToolsVersionInfo.cs | 20 ++- .../webdriver/DevTools/IDevToolsSession.cs | 8 +- .../DevTools/Json/JsonEnumMemberConverter.cs | 58 ++++++++ dotnet/src/webdriver/DomMutationData.cs | 14 +- dotnet/src/webdriver/DriverOptions.cs | 4 +- .../src/webdriver/Firefox/FirefoxExtension.cs | 4 +- .../src/webdriver/Firefox/FirefoxProfile.cs | 12 +- .../Internal/ResponseValueJsonConverter.cs | 110 +++++++-------- .../Internal/ReturnedCapabilities.cs | 4 +- dotnet/src/webdriver/JavaScriptEngine.cs | 4 +- dotnet/src/webdriver/Proxy.cs | 32 +++-- .../webdriver/Remote/RemoteSessionSettings.cs | 4 +- dotnet/src/webdriver/Response.cs | 15 ++- dotnet/src/webdriver/SeleniumManager.cs | 36 ++--- dotnet/src/webdriver/StackTraceElement.cs | 10 +- .../webdriver/WebDriver.StrongNamed.nuspec | 9 +- dotnet/src/webdriver/WebDriver.csproj | 8 +- dotnet/src/webdriver/WebDriver.nuspec | 9 +- .../test/chrome/WebDriver.Chrome.Tests.csproj | 2 +- dotnet/test/common/BUILD.bazel | 8 +- dotnet/test/common/ProxyTest.cs | 127 ------------------ dotnet/test/common/TakesScreenshotTest.cs | 16 +-- .../test/common/WebDriver.Common.Tests.csproj | 2 +- dotnet/test/edge/WebDriver.Edge.Tests.csproj | 2 +- .../firefox/WebDriver.Firefox.Tests.csproj | 2 +- dotnet/test/ie/WebDriver.IE.Tests.csproj | 2 +- .../test/remote/WebDriver.Remote.Tests.csproj | 2 +- .../test/safari/WebDriver.Safari.Tests.csproj | 2 +- .../support/WebDriver.Support.Tests.csproj | 2 +- .../src/generator/Templates/command.hbs | 8 +- .../src/generator/Templates/domain.hbs | 3 +- .../src/generator/Templates/event.hbs | 9 +- .../src/generator/Templates/type-enum.hbs | 5 +- .../src/generator/Templates/type-hash.hbs | 3 +- .../src/generator/Templates/type-object.hbs | 5 +- 47 files changed, 434 insertions(+), 375 deletions(-) create mode 100644 dotnet/src/webdriver/DevTools/Json/JsonEnumMemberConverter.cs diff --git a/MODULE.bazel b/MODULE.bazel index bde71eecb9491..a30c52009aca1 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -78,7 +78,7 @@ use_repo(esbuild, "esbuild_toolchains") register_toolchains("@esbuild_toolchains//:all") dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet") -dotnet.toolchain(dotnet_version = "7.0.400") +dotnet.toolchain(dotnet_version = "8.0.203") use_repo(dotnet, "dotnet_toolchains") selenium_paket = use_extension("//dotnet:paket.nuget_extension.bzl", "nuget_extension") diff --git a/dotnet/paket.dependencies b/dotnet/paket.dependencies index 22628f2abad5f..35689c811683c 100644 --- a/dotnet/paket.dependencies +++ b/dotnet/paket.dependencies @@ -24,5 +24,5 @@ nuget System.Diagnostics.Tools 4.3.0 nuget System.Drawing.Common 7.0.0 nuget System.Runtime 4.3.1 nuget System.Runtime.InteropServices 4.3.0 -nuget System.Text.Json 6.0.9 +nuget System.Text.Json 8.0.4 nuget Runfiles 0.12.0 diff --git a/dotnet/paket.lock b/dotnet/paket.lock index 6ecf981ae84ff..7edf7af4bafbf 100644 --- a/dotnet/paket.lock +++ b/dotnet/paket.lock @@ -15,7 +15,7 @@ NUGET System.Reflection.TypeExtensions (>= 4.4) Humanizer.Core (2.8.26) Microsoft.AspNetCore.App.Ref (6.0.9) - Microsoft.Bcl.AsyncInterfaces (7.0) - restriction: || (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) + Microsoft.Bcl.AsyncInterfaces (8.0) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) Microsoft.CSharp (4.5) Microsoft.Extensions.DependencyInjection (3.1.9) @@ -42,7 +42,7 @@ NUGET NETStandard.Library (>= 2.0) NUnit (3.13.2) Runfiles (0.12) - System.Buffers (4.5.1) - restriction: || (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) + System.Buffers (4.5.1) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) System.Diagnostics.EventLog (7.0) System.Security.Principal.Windows (>= 5.0) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) System.Diagnostics.Tools (4.3) @@ -61,7 +61,7 @@ NUGET System.Buffers (>= 4.5.1) - restriction: || (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= xamarinios)) (&& (== net7.0) (>= xamarinmac)) (&& (== net7.0) (>= xamarintvos)) (&& (== net7.0) (>= xamarinwatchos)) (== netstandard2.0) System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net7.0) (< netcoreapp2.0)) (== netstandard2.0) System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.1)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= uap10.1)) (&& (== net7.0) (>= xamarinios)) (&& (== net7.0) (>= xamarinmac)) (&& (== net7.0) (>= xamarintvos)) (&& (== net7.0) (>= xamarinwatchos)) (== netstandard2.0) - System.Numerics.Vectors (4.5) - restriction: || (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) + System.Numerics.Vectors (4.5) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< netcoreapp2.0)) (== netstandard2.0) System.Reflection (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -79,7 +79,7 @@ NUGET System.Runtime (4.3.1) Microsoft.NETCore.Platforms (>= 1.1.1) Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime.CompilerServices.Unsafe (6.0) + System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) System.Runtime.Handles (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -100,14 +100,13 @@ NUGET System.Buffers (>= 4.5.1) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) System.Memory (>= 4.5.5) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) - System.Text.Json (6.0.9) - Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: || (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Buffers (>= 4.5.1) - restriction: || (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Numerics.Vectors (>= 4.5) - restriction: || (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Encodings.Web (>= 6.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) + System.Text.Json (8.0.4) + Microsoft.Bcl.AsyncInterfaces (>= 8.0) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) + System.Buffers (>= 4.5.1) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) + System.Memory (>= 4.5.5) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) + System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) + System.Text.Encodings.Web (>= 8.0) + System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) System.Threading.Tasks (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) diff --git a/dotnet/paket.nuget.bzl b/dotnet/paket.nuget.bzl index a49c08bdcbb2d..abb3561080e65 100644 --- a/dotnet/paket.nuget.bzl +++ b/dotnet/paket.nuget.bzl @@ -13,7 +13,7 @@ def nuget(): {"name": "Handlebars.Net", "id": "Handlebars.Net", "version": "1.11.5", "sha512": "sha512-0MwU7vAXI3hT+9W7r7vadVZ21+HoGC5Z0Qc39JP+xxMlF7YOyZEhFByoQ2gtldWyeG6Gt2LglcFH8kJaXg/uiQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "net6.0": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "net7.0": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "net8.0": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "netcoreapp1.0": ["Microsoft.CSharp", "NETStandard.Library", "System.Reflection.TypeExtensions"], "netcoreapp1.1": ["Microsoft.CSharp", "NETStandard.Library", "System.Reflection.TypeExtensions"], "netcoreapp2.0": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "netcoreapp2.1": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "netcoreapp2.2": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "netcoreapp3.0": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "netcoreapp3.1": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": ["Microsoft.CSharp", "NETStandard.Library", "System.Reflection.TypeExtensions"], "netstandard1.4": ["Microsoft.CSharp", "NETStandard.Library", "System.Reflection.TypeExtensions"], "netstandard1.5": ["Microsoft.CSharp", "NETStandard.Library", "System.Reflection.TypeExtensions"], "netstandard1.6": ["Microsoft.CSharp", "NETStandard.Library", "System.Reflection.TypeExtensions"], "netstandard2.0": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"], "netstandard2.1": ["Microsoft.CSharp", "System.Reflection.TypeExtensions"]}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "Humanizer.Core", "id": "Humanizer.Core", "version": "2.8.26", "sha512": "sha512-hdDm8u0FrPEorV1qXA+W01DCR9zeNX5fwe5fXFUyzmA/JjLxMjt7/W672rSOWIjWHGkD6cZYOFLjIg/0O+a8kg==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": ["NETStandard.Library"], "net451": ["NETStandard.Library"], "net452": ["NETStandard.Library"], "net46": ["NETStandard.Library"], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "netcoreapp1.0": ["NETStandard.Library"], "netcoreapp1.1": ["NETStandard.Library"], "netcoreapp2.0": [], "netcoreapp2.1": [], "netcoreapp2.2": [], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": ["NETStandard.Library"], "netstandard1.1": ["NETStandard.Library"], "netstandard1.2": ["NETStandard.Library"], "netstandard1.3": ["NETStandard.Library"], "netstandard1.4": ["NETStandard.Library"], "netstandard1.5": ["NETStandard.Library"], "netstandard1.6": ["NETStandard.Library"], "netstandard2.0": [], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "Microsoft.AspNetCore.App.Ref", "id": "Microsoft.AspNetCore.App.Ref", "version": "6.0.9", "sha512": "sha512-uD7Y3nff4uUBryVsahaW3/krbzh0yPI2DY9iCak/wPTqJucwmVszCmkEIQOfmT4L9f13xcsqHq3eN+ka6YvIYg==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": [], "netcoreapp2.1": [], "netcoreapp2.2": [], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": [], "netstandard2.1": []}, "targeting_pack_overrides": ["Microsoft.Extensions.Caching.Abstractions|6.0.0", "Microsoft.Extensions.Caching.Memory|6.0.0", "Microsoft.Extensions.Configuration.Abstractions|6.0.0", "Microsoft.Extensions.Configuration.Binder|6.0.0", "Microsoft.Extensions.Configuration.CommandLine|6.0.0", "Microsoft.Extensions.Configuration|6.0.0", "Microsoft.Extensions.Configuration.EnvironmentVariables|6.0.0", "Microsoft.Extensions.Configuration.FileExtensions|6.0.0", "Microsoft.Extensions.Configuration.Ini|6.0.0", "Microsoft.Extensions.Configuration.Json|6.0.0", "Microsoft.Extensions.Configuration.UserSecrets|6.0.0", "Microsoft.Extensions.Configuration.Xml|6.0.0", "Microsoft.Extensions.DependencyInjection.Abstractions|6.0.0", "Microsoft.Extensions.DependencyInjection|6.0.0", "Microsoft.Extensions.FileProviders.Abstractions|6.0.0", "Microsoft.Extensions.FileProviders.Composite|6.0.0", "Microsoft.Extensions.FileProviders.Physical|6.0.0", "Microsoft.Extensions.FileSystemGlobbing|6.0.0", "Microsoft.Extensions.Hosting.Abstractions|6.0.0", "Microsoft.Extensions.Hosting|6.0.0", "Microsoft.Extensions.Http|6.0.0", "Microsoft.Extensions.Logging.Abstractions|6.0.0", "Microsoft.Extensions.Logging.Configuration|6.0.0", "Microsoft.Extensions.Logging.Console|6.0.0", "Microsoft.Extensions.Logging.Debug|6.0.0", "Microsoft.Extensions.Logging|6.0.0", "Microsoft.Extensions.Logging.EventLog|6.0.0", "Microsoft.Extensions.Logging.EventSource|6.0.0", "Microsoft.Extensions.Logging.TraceSource|6.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions|6.0.0", "Microsoft.Extensions.Options.DataAnnotations|6.0.0", "Microsoft.Extensions.Options|6.0.0", "Microsoft.Extensions.Primitives|6.0.0", "System.Diagnostics.EventLog|6.0.0", "System.IO.Pipelines|6.0.0", "System.Security.Cryptography.Xml|6.0.0", "Microsoft.AspNetCore.Antiforgery|6.0.0", "Microsoft.AspNetCore.Authentication.Abstractions|6.0.0", "Microsoft.AspNetCore.Authentication.Cookies|6.0.0", "Microsoft.AspNetCore.Authentication.Core|6.0.0", "Microsoft.AspNetCore.Authentication|6.0.0", "Microsoft.AspNetCore.Authentication.OAuth|6.0.0", "Microsoft.AspNetCore.Authorization|6.0.0", "Microsoft.AspNetCore.Authorization.Policy|6.0.0", "Microsoft.AspNetCore.Components.Authorization|6.0.0", "Microsoft.AspNetCore.Components|6.0.0", "Microsoft.AspNetCore.Components.Forms|6.0.0", "Microsoft.AspNetCore.Components.Server|6.0.0", "Microsoft.AspNetCore.Components.Web|6.0.0", "Microsoft.AspNetCore.Connections.Abstractions|6.0.0", "Microsoft.AspNetCore.CookiePolicy|6.0.0", "Microsoft.AspNetCore.Cors|6.0.0", "Microsoft.AspNetCore.Cryptography.Internal|6.0.0", "Microsoft.AspNetCore.Cryptography.KeyDerivation|6.0.0", "Microsoft.AspNetCore.DataProtection.Abstractions|6.0.0", "Microsoft.AspNetCore.DataProtection|6.0.0", "Microsoft.AspNetCore.DataProtection.Extensions|6.0.0", "Microsoft.AspNetCore.Diagnostics.Abstractions|6.0.0", "Microsoft.AspNetCore.Diagnostics|6.0.0", "Microsoft.AspNetCore.Diagnostics.HealthChecks|6.0.0", "Microsoft.AspNetCore|6.0.0", "Microsoft.AspNetCore.HostFiltering|6.0.0", "Microsoft.AspNetCore.Hosting.Abstractions|6.0.0", "Microsoft.AspNetCore.Hosting|6.0.0", "Microsoft.AspNetCore.Hosting.Server.Abstractions|6.0.0", "Microsoft.AspNetCore.Html.Abstractions|6.0.0", "Microsoft.AspNetCore.Http.Abstractions|6.0.0", "Microsoft.AspNetCore.Http.Connections.Common|6.0.0", "Microsoft.AspNetCore.Http.Connections|6.0.0", "Microsoft.AspNetCore.Http|6.0.0", "Microsoft.AspNetCore.Http.Extensions|6.0.0", "Microsoft.AspNetCore.Http.Features|6.0.0", "Microsoft.AspNetCore.Http.Results|6.0.0", "Microsoft.AspNetCore.HttpLogging|6.0.0", "Microsoft.AspNetCore.HttpOverrides|6.0.0", "Microsoft.AspNetCore.HttpsPolicy|6.0.0", "Microsoft.AspNetCore.Identity|6.0.0", "Microsoft.AspNetCore.Localization|6.0.0", "Microsoft.AspNetCore.Localization.Routing|6.0.0", "Microsoft.AspNetCore.Metadata|6.0.0", "Microsoft.AspNetCore.Mvc.Abstractions|6.0.0", "Microsoft.AspNetCore.Mvc.ApiExplorer|6.0.0", "Microsoft.AspNetCore.Mvc.Core|6.0.0", "Microsoft.AspNetCore.Mvc.Cors|6.0.0", "Microsoft.AspNetCore.Mvc.DataAnnotations|6.0.0", "Microsoft.AspNetCore.Mvc|6.0.0", "Microsoft.AspNetCore.Mvc.Formatters.Json|6.0.0", "Microsoft.AspNetCore.Mvc.Formatters.Xml|6.0.0", "Microsoft.AspNetCore.Mvc.Localization|6.0.0", "Microsoft.AspNetCore.Mvc.Razor|6.0.0", "Microsoft.AspNetCore.Mvc.RazorPages|6.0.0", "Microsoft.AspNetCore.Mvc.TagHelpers|6.0.0", "Microsoft.AspNetCore.Mvc.ViewFeatures|6.0.0", "Microsoft.AspNetCore.Razor|6.0.0", "Microsoft.AspNetCore.Razor.Runtime|6.0.0", "Microsoft.AspNetCore.ResponseCaching.Abstractions|6.0.0", "Microsoft.AspNetCore.ResponseCaching|6.0.0", "Microsoft.AspNetCore.ResponseCompression|6.0.0", "Microsoft.AspNetCore.Rewrite|6.0.0", "Microsoft.AspNetCore.Routing.Abstractions|6.0.0", "Microsoft.AspNetCore.Routing|6.0.0", "Microsoft.AspNetCore.Server.HttpSys|6.0.0", "Microsoft.AspNetCore.Server.IIS|6.0.0", "Microsoft.AspNetCore.Server.IISIntegration|6.0.0", "Microsoft.AspNetCore.Server.Kestrel.Core|6.0.0", "Microsoft.AspNetCore.Server.Kestrel|6.0.0", "Microsoft.AspNetCore.Server.Kestrel.Transport.Quic|6.0.0", "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets|6.0.0", "Microsoft.AspNetCore.Session|6.0.0", "Microsoft.AspNetCore.SignalR.Common|6.0.0", "Microsoft.AspNetCore.SignalR.Core|6.0.0", "Microsoft.AspNetCore.SignalR|6.0.0", "Microsoft.AspNetCore.SignalR.Protocols.Json|6.0.0", "Microsoft.AspNetCore.StaticFiles|6.0.0", "Microsoft.AspNetCore.WebSockets|6.0.0", "Microsoft.AspNetCore.WebUtilities|6.0.0", "Microsoft.Extensions.Configuration.KeyPerFile|6.0.0", "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions|6.0.0", "Microsoft.Extensions.Diagnostics.HealthChecks|6.0.0", "Microsoft.Extensions.Features|6.0.0", "Microsoft.Extensions.FileProviders.Embedded|6.0.0", "Microsoft.Extensions.Identity.Core|6.0.0", "Microsoft.Extensions.Identity.Stores|6.0.0", "Microsoft.Extensions.Localization.Abstractions|6.0.0", "Microsoft.Extensions.Localization|6.0.0", "Microsoft.Extensions.ObjectPool|6.0.0", "Microsoft.Extensions.WebEncoders|6.0.0", "Microsoft.JSInterop|6.0.0", "Microsoft.Net.Http.Headers|6.0.0"], "framework_list": ["Microsoft.AspNetCore.Antiforgery|6.0.0.0", "Microsoft.AspNetCore.Authentication.Abstractions|6.0.0.0", "Microsoft.AspNetCore.Authentication.Cookies|6.0.0.0", "Microsoft.AspNetCore.Authentication.Core|6.0.0.0", "Microsoft.AspNetCore.Authentication.OAuth|6.0.0.0", "Microsoft.AspNetCore.Authentication|6.0.0.0", "Microsoft.AspNetCore.Authorization.Policy|6.0.0.0", "Microsoft.AspNetCore.Authorization|6.0.0.0", "Microsoft.AspNetCore.Components.Authorization|6.0.0.0", "Microsoft.AspNetCore.Components.Forms|6.0.0.0", "Microsoft.AspNetCore.Components.Server|6.0.0.0", "Microsoft.AspNetCore.Components.Web|6.0.0.0", "Microsoft.AspNetCore.Components|6.0.0.0", "Microsoft.AspNetCore.Connections.Abstractions|6.0.0.0", "Microsoft.AspNetCore.CookiePolicy|6.0.0.0", "Microsoft.AspNetCore.Cors|6.0.0.0", "Microsoft.AspNetCore.Cryptography.Internal|6.0.0.0", "Microsoft.AspNetCore.Cryptography.KeyDerivation|6.0.0.0", "Microsoft.AspNetCore.DataProtection.Abstractions|6.0.0.0", "Microsoft.AspNetCore.DataProtection.Extensions|6.0.0.0", "Microsoft.AspNetCore.DataProtection|6.0.0.0", "Microsoft.AspNetCore.Diagnostics.Abstractions|6.0.0.0", "Microsoft.AspNetCore.Diagnostics.HealthChecks|6.0.0.0", "Microsoft.AspNetCore.Diagnostics|6.0.0.0", "Microsoft.AspNetCore.HostFiltering|6.0.0.0", "Microsoft.AspNetCore.Hosting.Abstractions|6.0.0.0", "Microsoft.AspNetCore.Hosting.Server.Abstractions|6.0.0.0", "Microsoft.AspNetCore.Hosting|6.0.0.0", "Microsoft.AspNetCore.Html.Abstractions|6.0.0.0", "Microsoft.AspNetCore.Http.Abstractions|6.0.0.0", "Microsoft.AspNetCore.Http.Connections.Common|6.0.0.0", "Microsoft.AspNetCore.Http.Connections|6.0.0.0", "Microsoft.AspNetCore.Http.Extensions|6.0.0.0", "Microsoft.AspNetCore.Http.Features|6.0.0.0", "Microsoft.AspNetCore.Http.Results|6.0.0.0", "Microsoft.AspNetCore.Http|6.0.0.0", "Microsoft.AspNetCore.HttpLogging|6.0.0.0", "Microsoft.AspNetCore.HttpOverrides|6.0.0.0", "Microsoft.AspNetCore.HttpsPolicy|6.0.0.0", "Microsoft.AspNetCore.Identity|6.0.0.0", "Microsoft.AspNetCore.Localization.Routing|6.0.0.0", "Microsoft.AspNetCore.Localization|6.0.0.0", "Microsoft.AspNetCore.Metadata|6.0.0.0", "Microsoft.AspNetCore.Mvc.Abstractions|6.0.0.0", "Microsoft.AspNetCore.Mvc.ApiExplorer|6.0.0.0", "Microsoft.AspNetCore.Mvc.Core|6.0.0.0", "Microsoft.AspNetCore.Mvc.Cors|6.0.0.0", "Microsoft.AspNetCore.Mvc.DataAnnotations|6.0.0.0", "Microsoft.AspNetCore.Mvc.Formatters.Json|6.0.0.0", "Microsoft.AspNetCore.Mvc.Formatters.Xml|6.0.0.0", "Microsoft.AspNetCore.Mvc.Localization|6.0.0.0", "Microsoft.AspNetCore.Mvc.Razor|6.0.0.0", "Microsoft.AspNetCore.Mvc.RazorPages|6.0.0.0", "Microsoft.AspNetCore.Mvc.TagHelpers|6.0.0.0", "Microsoft.AspNetCore.Mvc.ViewFeatures|6.0.0.0", "Microsoft.AspNetCore.Mvc|6.0.0.0", "Microsoft.AspNetCore.Razor.Runtime|6.0.0.0", "Microsoft.AspNetCore.Razor|6.0.0.0", "Microsoft.AspNetCore.ResponseCaching.Abstractions|6.0.0.0", "Microsoft.AspNetCore.ResponseCaching|6.0.0.0", "Microsoft.AspNetCore.ResponseCompression|6.0.0.0", "Microsoft.AspNetCore.Rewrite|6.0.0.0", "Microsoft.AspNetCore.Routing.Abstractions|6.0.0.0", "Microsoft.AspNetCore.Routing|6.0.0.0", "Microsoft.AspNetCore.Server.HttpSys|6.0.0.0", "Microsoft.AspNetCore.Server.IIS|6.0.0.0", "Microsoft.AspNetCore.Server.IISIntegration|6.0.0.0", "Microsoft.AspNetCore.Server.Kestrel.Core|6.0.0.0", "Microsoft.AspNetCore.Server.Kestrel.Transport.Quic|6.0.0.0", "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets|6.0.0.0", "Microsoft.AspNetCore.Server.Kestrel|6.0.0.0", "Microsoft.AspNetCore.Session|6.0.0.0", "Microsoft.AspNetCore.SignalR.Common|6.0.0.0", "Microsoft.AspNetCore.SignalR.Core|6.0.0.0", "Microsoft.AspNetCore.SignalR.Protocols.Json|6.0.0.0", "Microsoft.AspNetCore.SignalR|6.0.0.0", "Microsoft.AspNetCore.StaticFiles|6.0.0.0", "Microsoft.AspNetCore.WebSockets|6.0.0.0", "Microsoft.AspNetCore.WebUtilities|6.0.0.0", "Microsoft.AspNetCore|6.0.0.0", "Microsoft.Extensions.Caching.Abstractions|6.0.0.0", "Microsoft.Extensions.Caching.Memory|6.0.0.0", "Microsoft.Extensions.Configuration.Abstractions|6.0.0.0", "Microsoft.Extensions.Configuration.Binder|6.0.0.0", "Microsoft.Extensions.Configuration.CommandLine|6.0.0.0", "Microsoft.Extensions.Configuration.EnvironmentVariables|6.0.0.0", "Microsoft.Extensions.Configuration.FileExtensions|6.0.0.0", "Microsoft.Extensions.Configuration.Ini|6.0.0.0", "Microsoft.Extensions.Configuration.Json|6.0.0.0", "Microsoft.Extensions.Configuration.KeyPerFile|6.0.0.0", "Microsoft.Extensions.Configuration.UserSecrets|6.0.0.0", "Microsoft.Extensions.Configuration.Xml|6.0.0.0", "Microsoft.Extensions.Configuration|6.0.0.0", "Microsoft.Extensions.DependencyInjection.Abstractions|6.0.0.0", "Microsoft.Extensions.DependencyInjection|6.0.0.0", "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions|6.0.0.0", "Microsoft.Extensions.Diagnostics.HealthChecks|6.0.0.0", "Microsoft.Extensions.Features|6.0.0.0", "Microsoft.Extensions.FileProviders.Abstractions|6.0.0.0", "Microsoft.Extensions.FileProviders.Composite|6.0.0.0", "Microsoft.Extensions.FileProviders.Embedded|6.0.0.0", "Microsoft.Extensions.FileProviders.Physical|6.0.0.0", "Microsoft.Extensions.FileSystemGlobbing|6.0.0.0", "Microsoft.Extensions.Hosting.Abstractions|6.0.0.0", "Microsoft.Extensions.Hosting|6.0.0.0", "Microsoft.Extensions.Http|6.0.0.0", "Microsoft.Extensions.Identity.Core|6.0.0.0", "Microsoft.Extensions.Identity.Stores|6.0.0.0", "Microsoft.Extensions.Localization.Abstractions|6.0.0.0", "Microsoft.Extensions.Localization|6.0.0.0", "Microsoft.Extensions.Logging.Abstractions|6.0.0.0", "Microsoft.Extensions.Logging.Configuration|6.0.0.0", "Microsoft.Extensions.Logging.Console|6.0.0.0", "Microsoft.Extensions.Logging.Debug|6.0.0.0", "Microsoft.Extensions.Logging.EventLog|6.0.0.0", "Microsoft.Extensions.Logging.EventSource|6.0.0.0", "Microsoft.Extensions.Logging.TraceSource|6.0.0.0", "Microsoft.Extensions.Logging|6.0.0.0", "Microsoft.Extensions.ObjectPool|6.0.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions|6.0.0.0", "Microsoft.Extensions.Options.DataAnnotations|6.0.0.0", "Microsoft.Extensions.Options|6.0.0.0", "Microsoft.Extensions.Primitives|6.0.0.0", "Microsoft.Extensions.WebEncoders|6.0.0.0", "Microsoft.JSInterop|6.0.0.0", "Microsoft.Net.Http.Headers|6.0.0.0", "System.Diagnostics.EventLog|6.0.0.0", "System.IO.Pipelines|6.0.0.0", "System.Security.Cryptography.Xml|6.0.0.0"]}, - {"name": "Microsoft.Bcl.AsyncInterfaces", "id": "Microsoft.Bcl.AsyncInterfaces", "version": "7.0.0", "sha512": "sha512-Nb9B1lxCab0LZi0ijNLEpw4hgwt0Wl8QQM1DxIhJS2otChAtIVMfyGrYl3YzdSjspvBYPliJlr0kCtizNAVe3w==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": ["System.Threading.Tasks.Extensions"], "net462": ["System.Threading.Tasks.Extensions"], "net47": ["System.Threading.Tasks.Extensions"], "net471": ["System.Threading.Tasks.Extensions"], "net472": ["System.Threading.Tasks.Extensions"], "net48": ["System.Threading.Tasks.Extensions"], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["System.Threading.Tasks.Extensions"], "netcoreapp2.1": ["System.Threading.Tasks.Extensions"], "netcoreapp2.2": ["System.Threading.Tasks.Extensions"], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["System.Threading.Tasks.Extensions"], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []}, + {"name": "Microsoft.Bcl.AsyncInterfaces", "id": "Microsoft.Bcl.AsyncInterfaces", "version": "8.0.0", "sha512": "sha512-ecsHc9lEZZJM7k5HHZA1PV2N+ELEarLFcssV2bn7XQIJoaiNZDkplTNcX+VKANfDGURAuEyVFCcRu7aFy16VUg==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": ["System.Threading.Tasks.Extensions"], "net462": ["System.Threading.Tasks.Extensions"], "net47": ["System.Threading.Tasks.Extensions"], "net471": ["System.Threading.Tasks.Extensions"], "net472": ["System.Threading.Tasks.Extensions"], "net48": ["System.Threading.Tasks.Extensions"], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["System.Threading.Tasks.Extensions"], "netcoreapp2.1": ["System.Threading.Tasks.Extensions"], "netcoreapp2.2": ["System.Threading.Tasks.Extensions"], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["System.Threading.Tasks.Extensions"], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "Microsoft.CSharp", "id": "Microsoft.CSharp", "version": "4.5.0", "sha512": "sha512-yWWeTbGCzBOlRPWDCIxiTZW1ecZiMbao0ZT97KKEWdBhrLvUqU8RdzkhzuCRQzvoxzxlR7vytO43OOgFdkxv6g==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "netcoreapp1.0": ["NETStandard.Library", "System.Reflection.TypeExtensions"], "netcoreapp1.1": ["NETStandard.Library", "System.Reflection.TypeExtensions"], "netcoreapp2.0": [], "netcoreapp2.1": [], "netcoreapp2.2": [], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": ["NETStandard.Library"], "netstandard1.1": ["NETStandard.Library"], "netstandard1.2": ["NETStandard.Library"], "netstandard1.3": ["NETStandard.Library", "System.Reflection.TypeExtensions"], "netstandard1.4": ["NETStandard.Library", "System.Reflection.TypeExtensions"], "netstandard1.5": ["NETStandard.Library", "System.Reflection.TypeExtensions"], "netstandard1.6": ["NETStandard.Library", "System.Reflection.TypeExtensions"], "netstandard2.0": [], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "Microsoft.Extensions.DependencyInjection", "id": "Microsoft.Extensions.DependencyInjection", "version": "3.1.9", "sha512": "sha512-vMQqPTihUGUTAzlr4354IcThGnC+ayzonlXLGBmnC6tdNUi40kKlqVl1d71RFgqV7Sj6L/ZmATPaX/xxCj5hAA==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "net462": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "net47": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "net471": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "net472": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "net48": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "net5.0": ["Microsoft.Extensions.DependencyInjection.Abstractions"], "net6.0": ["Microsoft.Extensions.DependencyInjection.Abstractions"], "net7.0": ["Microsoft.Extensions.DependencyInjection.Abstractions"], "net8.0": ["Microsoft.Extensions.DependencyInjection.Abstractions"], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "netcoreapp2.1": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "netcoreapp2.2": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "netcoreapp3.0": ["Microsoft.Extensions.DependencyInjection.Abstractions"], "netcoreapp3.1": ["Microsoft.Extensions.DependencyInjection.Abstractions"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["Microsoft.Extensions.DependencyInjection.Abstractions", "Microsoft.Bcl.AsyncInterfaces"], "netstandard2.1": ["Microsoft.Extensions.DependencyInjection.Abstractions"]}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "Microsoft.Extensions.DependencyInjection.Abstractions", "id": "Microsoft.Extensions.DependencyInjection.Abstractions", "version": "3.1.9", "sha512": "sha512-qbiwYBpKjQ2u3FNFDuznksbzsR7e/pUK2XR/osxiU/1Lo+M8MqjRnvBm5x/Uvtv2iDdMNQ2N+smrPgRGKDXboQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": [], "netcoreapp2.1": [], "netcoreapp2.2": [], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": [], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []}, @@ -50,7 +50,7 @@ def nuget(): {"name": "System.Security.Principal.Windows", "id": "System.Security.Principal.Windows", "version": "5.0.0", "sha512": "sha512-RKkgqq8ishctQTGbtXqyuOGkUx1fAhkqb1OoHYdRJRlbYLoLWkSkWYHRN/17DzplsSlZtf2Xr8BXjNhO8nRnzQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "netcoreapp1.0": ["System.Reflection", "System.Runtime", "System.Runtime.Handles", "System.Runtime.InteropServices", "System.Text.Encoding"], "netcoreapp1.1": ["System.Reflection", "System.Runtime", "System.Runtime.Handles", "System.Runtime.InteropServices", "System.Text.Encoding"], "netcoreapp2.0": ["Microsoft.NETCore.Platforms"], "netcoreapp2.1": ["Microsoft.NETCore.Platforms"], "netcoreapp2.2": ["Microsoft.NETCore.Platforms"], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": ["System.Reflection", "System.Runtime", "System.Runtime.Handles", "System.Runtime.InteropServices", "System.Text.Encoding"], "netstandard1.4": ["System.Reflection", "System.Runtime", "System.Runtime.Handles", "System.Runtime.InteropServices", "System.Text.Encoding"], "netstandard1.5": ["System.Reflection", "System.Runtime", "System.Runtime.Handles", "System.Runtime.InteropServices", "System.Text.Encoding"], "netstandard1.6": ["System.Reflection", "System.Runtime", "System.Runtime.Handles", "System.Runtime.InteropServices", "System.Text.Encoding"], "netstandard2.0": [], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "System.Text.Encoding", "id": "System.Text.Encoding", "version": "4.3.0", "sha512": "sha512-b/f+7HMTpxIfeV7H03bkuHKMFylCGfr9/U6gePnfFFW0aF8LOWLDgQCY6V1oWUqDksC3mdNuyChM1vy9TP4sZw==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "net6.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "net7.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "net8.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp1.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp1.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp2.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp2.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp2.2": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp3.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp3.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard": [], "netstandard1.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.2": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.3": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.4": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.5": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.6": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard2.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard2.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"]}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "System.Text.Encodings.Web", "id": "System.Text.Encodings.Web", "version": "8.0.0", "sha512": "sha512-uggiw4w7ZYq6lJVkLSaeiCuCfjvkrS3BQm2Kl9PLxaInfF+AhH0MuTgQeK8BUjMoxJksqgWBRtXY7muKCGCcMg==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "net462": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "net47": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "net471": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "net472": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "net48": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "net5.0": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "net6.0": ["System.Runtime.CompilerServices.Unsafe"], "net7.0": [], "net8.0": [], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "netcoreapp2.1": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "netcoreapp2.2": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "netcoreapp3.0": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "netcoreapp3.1": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"], "netstandard2.1": ["System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe"]}, "targeting_pack_overrides": [], "framework_list": []}, - {"name": "System.Text.Json", "id": "System.Text.Json", "version": "6.0.9", "sha512": "sha512-as7kWI67Stsl6uS9mWf74R9YWD2uakVSh0YbijKqbkFEfoZJodZJISry+w2RrAZvyffGtaTxi0jNB+Zt44Byzg==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "net462": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "net47": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "net471": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "net472": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "net48": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "net5.0": ["System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web"], "net6.0": ["System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web"], "net7.0": ["System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web"], "net8.0": ["System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web"], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "netcoreapp2.1": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "netcoreapp2.2": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "netcoreapp3.0": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "netcoreapp3.1": ["System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"], "netstandard2.1": ["Microsoft.Bcl.AsyncInterfaces", "System.Runtime.CompilerServices.Unsafe", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions"]}, "targeting_pack_overrides": [], "framework_list": []}, + {"name": "System.Text.Json", "id": "System.Text.Json", "version": "8.0.4", "sha512": "sha512-n4fuKjm6T2AqKz7HWEuKosA6f22x4wP0giTbwTndvzyxAZC+BO/h0VkrC/Wy/Zf22PiP1JKkX3eLhP0+YTrLAA==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "net462": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "net47": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "net471": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "net472": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "net48": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "net5.0": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "net6.0": ["System.Text.Encodings.Web", "System.Runtime.CompilerServices.Unsafe"], "net7.0": ["System.Text.Encodings.Web"], "net8.0": ["System.Text.Encodings.Web"], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "netcoreapp2.1": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "netcoreapp2.2": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "netcoreapp3.0": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "netcoreapp3.1": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"], "netstandard2.1": ["Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web", "System.Buffers", "System.Memory", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks.Extensions"]}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "System.Threading.Tasks", "id": "System.Threading.Tasks", "version": "4.3.0", "sha512": "sha512-fUiP+CyyCjs872OA8trl6p97qma/da1xGq3h4zAbJZk8zyaU4zyEfqW5vbkP80xG/Nimun1vlWBboMEk7XxdEw==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": [], "net462": [], "net47": [], "net471": [], "net472": [], "net48": [], "net5.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "net6.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "net7.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "net8.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp1.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp1.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp2.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp2.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp2.2": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp3.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netcoreapp3.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard": [], "netstandard1.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.2": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.3": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.4": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.5": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard1.6": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard2.0": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"], "netstandard2.1": ["Microsoft.NETCore.Platforms", "Microsoft.NETCore.Targets", "System.Runtime"]}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "System.Threading.Tasks.Extensions", "id": "System.Threading.Tasks.Extensions", "version": "4.5.4", "sha512": "sha512-aAUghud9PHGYc3o9oWPWd0C3xE+TJQw5ZZs78htlR6mr9ky/QEgfXHjyQ2GvOq9H1S0YizcVVKCSin92ZcH8FA==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": ["System.Runtime.CompilerServices.Unsafe"], "net451": ["System.Runtime.CompilerServices.Unsafe"], "net452": ["System.Runtime.CompilerServices.Unsafe"], "net46": ["System.Runtime.CompilerServices.Unsafe"], "net461": ["System.Runtime.CompilerServices.Unsafe"], "net462": ["System.Runtime.CompilerServices.Unsafe"], "net47": ["System.Runtime.CompilerServices.Unsafe"], "net471": ["System.Runtime.CompilerServices.Unsafe"], "net472": ["System.Runtime.CompilerServices.Unsafe"], "net48": ["System.Runtime.CompilerServices.Unsafe"], "net5.0": [], "net6.0": [], "net7.0": [], "net8.0": [], "netcoreapp1.0": ["System.Runtime", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks"], "netcoreapp1.1": ["System.Runtime", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks"], "netcoreapp2.0": ["System.Runtime.CompilerServices.Unsafe"], "netcoreapp2.1": [], "netcoreapp2.2": [], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": ["System.Runtime", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks"], "netstandard1.1": ["System.Runtime", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks"], "netstandard1.2": ["System.Runtime", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks"], "netstandard1.3": ["System.Runtime", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks"], "netstandard1.4": ["System.Runtime", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks"], "netstandard1.5": ["System.Runtime", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks"], "netstandard1.6": ["System.Runtime", "System.Runtime.CompilerServices.Unsafe", "System.Threading.Tasks"], "netstandard2.0": ["System.Runtime.CompilerServices.Unsafe"], "netstandard2.1": ["System.Runtime.CompilerServices.Unsafe"]}, "targeting_pack_overrides": [], "framework_list": []}, ], diff --git a/dotnet/src/support/BUILD.bazel b/dotnet/src/support/BUILD.bazel index 1dfa93737382c..abf65ed58a889 100644 --- a/dotnet/src/support/BUILD.bazel +++ b/dotnet/src/support/BUILD.bazel @@ -1,7 +1,6 @@ load( "//dotnet:defs.bzl", "csharp_library", - "framework", "generated_assembly_info", "nuget_pack", ) @@ -43,8 +42,7 @@ csharp_library( "//dotnet:__subpackages__", ], deps = [ - "//dotnet/src/webdriver", - framework("nuget", "NETStandard.Library"), + "//dotnet/src/webdriver:webdriver-netstandard2.0", ], ) @@ -83,8 +81,7 @@ csharp_library( "//dotnet:__subpackages__", ], deps = [ - "//dotnet/src/webdriver:webdriver-strongnamed", - framework("nuget", "NETStandard.Library"), + "//dotnet/src/webdriver:webdriver-netstandard2.0-strongnamed", ], ) diff --git a/dotnet/src/webdriver/BUILD.bazel b/dotnet/src/webdriver/BUILD.bazel index 33809c85c1c5f..2e1c41bfb56df 100644 --- a/dotnet/src/webdriver/BUILD.bazel +++ b/dotnet/src/webdriver/BUILD.bazel @@ -26,7 +26,7 @@ generated_assembly_info( ) csharp_library( - name = "webdriver", + name = "webdriver-netstandard2.0", srcs = [ ":assembly-info", ] + glob([ @@ -36,7 +36,7 @@ csharp_library( internals_visible_to = [ "WebDriver.Common.Tests", ], - langversion = "10.0", + langversion = "12.0", resources = [ "//javascript/atoms/fragments:find-elements.js", "//javascript/atoms/fragments:is-displayed.js", @@ -52,12 +52,42 @@ csharp_library( ], deps = [ framework("nuget", "NETStandard.Library"), - framework("nuget", "Newtonsoft.Json"), + framework("nuget", "System.Memory"), + framework("nuget", "System.Text.Json"), ], ) csharp_library( - name = "webdriver-strongnamed", + name = "webdriver-net8.0", + srcs = [ + ":assembly-info", + ] + glob([ + "**/*.cs", + ]) + devtools_version_targets(), + out = "WebDriver", + internals_visible_to = [ + "WebDriver.Common.Tests", + ], + langversion = "12.0", + resources = [ + "//javascript/atoms/fragments:find-elements.js", + "//javascript/atoms/fragments:is-displayed.js", + "//javascript/cdp-support:mutation-listener.js", + "//javascript/webdriver/atoms:get-attribute.js", + "//third_party/js/selenium:webdriver_json", + ], + target_frameworks = [ + "net8.0", + ], + visibility = [ + "//dotnet:__subpackages__", + ], + deps = [ + ], +) + +csharp_library( + name = "webdriver-netstandard2.0-strongnamed", srcs = [ ":assembly-info", ] + glob([ @@ -65,7 +95,7 @@ csharp_library( ]) + devtools_version_targets(), out = "WebDriver.StrongNamed", keyfile = "//dotnet:WebDriver.snk", - langversion = "10.0", + langversion = "12.0", resources = [ "//javascript/atoms/fragments:find-elements.js", "//javascript/atoms/fragments:is-displayed.js", @@ -81,7 +111,35 @@ csharp_library( ], deps = [ framework("nuget", "NETStandard.Library"), - framework("nuget", "Newtonsoft.Json"), + framework("nuget", "System.Memory"), + framework("nuget", "System.Text.Json"), + ], +) + +csharp_library( + name = "webdriver-net8.0-strongnamed", + srcs = [ + ":assembly-info", + ] + glob([ + "**/*.cs", + ]) + devtools_version_targets(), + out = "WebDriver.StrongNamed", + keyfile = "//dotnet:WebDriver.snk", + langversion = "12.0", + resources = [ + "//javascript/atoms/fragments:find-elements.js", + "//javascript/atoms/fragments:is-displayed.js", + "//javascript/cdp-support:mutation-listener.js", + "//javascript/webdriver/atoms:get-attribute.js", + "//third_party/js/selenium:webdriver_json", + ], + target_frameworks = [ + "net8.0", + ], + visibility = [ + "//dotnet:__subpackages__", + ], + deps = [ ], ) @@ -137,7 +195,8 @@ nuget_pack( }, id = "Selenium.WebDriver", libs = { - ":webdriver": "WebDriver", + ":webdriver-net8.0": "WebDriver", + ":webdriver-netstandard2.0": "WebDriver", }, nuspec_template = "WebDriver.nuspec", tags = [ @@ -162,7 +221,8 @@ nuget_pack( }, id = "Selenium.WebDriver.StrongNamed", libs = { - ":webdriver-strongnamed": "WebDriver.StrongNamed", + ":webdriver-net8.0-strongnamed": "WebDriver.StrongNamed", + ":webdriver-netstandard2.0-strongnamed": "WebDriver.StrongNamed", }, nuspec_template = "WebDriver.StrongNamed.nuspec", property_group_vars = { diff --git a/dotnet/src/webdriver/Chromium/ChromiumNetworkConditions.cs b/dotnet/src/webdriver/Chromium/ChromiumNetworkConditions.cs index 5d40dae213105..9a80a7afac22e 100644 --- a/dotnet/src/webdriver/Chromium/ChromiumNetworkConditions.cs +++ b/dotnet/src/webdriver/Chromium/ChromiumNetworkConditions.cs @@ -16,16 +16,15 @@ // limitations under the License. // -using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.Chromium { /// /// Provides manipulation of getting and setting network conditions from Chromium. /// - [JsonObject(MemberSerialization.OptIn)] public class ChromiumNetworkConditions { private bool offline; @@ -36,7 +35,7 @@ public class ChromiumNetworkConditions /// /// Gets or sets a value indicating whether the network is offline. Defaults to . /// - [JsonProperty("offline")] + [JsonPropertyName("offline")] public bool IsOffline { get { return this.offline; } @@ -46,6 +45,7 @@ public bool IsOffline /// /// Gets or sets the simulated latency of the connection. Typically given in milliseconds. /// + [JsonIgnore] public TimeSpan Latency { get { return this.latency; } @@ -55,7 +55,7 @@ public TimeSpan Latency /// /// Gets or sets the throughput of the network connection in bytes/second for downloading. /// - [JsonProperty("download_throughput")] + [JsonPropertyName("download_throughput")] public long DownloadThroughput { get { return this.downloadThroughput; } @@ -73,7 +73,7 @@ public long DownloadThroughput /// /// Gets or sets the throughput of the network connection in bytes/second for uploading. /// - [JsonProperty("upload_throughput")] + [JsonPropertyName("upload_throughput")] public long UploadThroughput { get { return this.uploadThroughput; } @@ -88,7 +88,9 @@ public long UploadThroughput } } - [JsonProperty("latency", NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("latency")] + [JsonInclude] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] internal long? SerializableLatency { get diff --git a/dotnet/src/webdriver/Command.cs b/dotnet/src/webdriver/Command.cs index e147b1b1eb509..d12274ca90d7a 100644 --- a/dotnet/src/webdriver/Command.cs +++ b/dotnet/src/webdriver/Command.cs @@ -16,9 +16,10 @@ // limitations under the License. // -using Newtonsoft.Json; using OpenQA.Selenium.Internal; using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; namespace OpenQA.Selenium { @@ -27,6 +28,11 @@ namespace OpenQA.Selenium /// public class Command { + private readonly static JsonSerializerOptions s_jsonSerializerOptions = new() + { + Converters = { new ResponseValueJsonConverter() } + }; + private SessionId commandSessionId; private string commandName; private Dictionary commandParameters = new Dictionary(); @@ -61,7 +67,7 @@ public Command(SessionId sessionId, string name, Dictionary para /// /// Gets the SessionID of the command /// - [JsonProperty("sessionId")] + [JsonPropertyName("sessionId")] public SessionId SessionId { get { return this.commandSessionId; } @@ -70,7 +76,7 @@ public SessionId SessionId /// /// Gets the command name /// - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get { return this.commandName; } @@ -79,7 +85,7 @@ public string Name /// /// Gets the parameters of the command /// - [JsonProperty("parameters")] + [JsonPropertyName("parameters")] public Dictionary Parameters { get { return this.commandParameters; } @@ -95,7 +101,7 @@ public string ParametersAsJsonString string parametersString = string.Empty; if (this.commandParameters != null && this.commandParameters.Count > 0) { - parametersString = JsonConvert.SerializeObject(this.commandParameters); + parametersString = JsonSerializer.Serialize(this.commandParameters); } if (string.IsNullOrEmpty(parametersString)) @@ -123,7 +129,7 @@ public override string ToString() /// A with a string keys, and an object value. private static Dictionary ConvertParametersFromJson(string value) { - Dictionary parameters = JsonConvert.DeserializeObject>(value, new ResponseValueJsonConverter()); + Dictionary parameters = JsonSerializer.Deserialize>(value, s_jsonSerializerOptions); return parameters; } } diff --git a/dotnet/src/webdriver/Cookie.cs b/dotnet/src/webdriver/Cookie.cs index 8ce2ff7d56a9a..5b28cd46b7ff6 100644 --- a/dotnet/src/webdriver/Cookie.cs +++ b/dotnet/src/webdriver/Cookie.cs @@ -16,12 +16,12 @@ // limitations under the License. // -using Newtonsoft.Json; using OpenQA.Selenium.Internal; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Text.Json.Serialization; namespace OpenQA.Selenium { @@ -29,7 +29,6 @@ namespace OpenQA.Selenium /// Represents a cookie in the browser. /// [Serializable] - [JsonObject(MemberSerialization = MemberSerialization.OptIn)] public class Cookie { private string cookieName; @@ -171,7 +170,7 @@ public Cookie(string name, string value, string domain, string path, DateTime? e /// /// Gets the name of the cookie. /// - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get { return this.cookieName; } @@ -180,7 +179,7 @@ public string Name /// /// Gets the value of the cookie. /// - [JsonProperty("value")] + [JsonPropertyName("value")] public string Value { get { return this.cookieValue; } @@ -189,7 +188,8 @@ public string Value /// /// Gets the domain of the cookie. /// - [JsonProperty("domain", NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("domain")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string Domain { get { return this.cookieDomain; } @@ -198,7 +198,8 @@ public string Domain /// /// Gets the path of the cookie. /// - [JsonProperty("path", NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("path")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public virtual string Path { get { return this.cookiePath; } @@ -207,7 +208,7 @@ public virtual string Path /// /// Gets a value indicating whether the cookie is secure. /// - [JsonProperty("secure")] + [JsonPropertyName("secure")] public virtual bool Secure { get { return this.secure; } @@ -216,7 +217,7 @@ public virtual bool Secure /// /// Gets a value indicating whether the cookie is an HTTP-only cookie. /// - [JsonProperty("httpOnly")] + [JsonPropertyName("httpOnly")] public virtual bool IsHttpOnly { get { return this.isHttpOnly; } @@ -226,7 +227,8 @@ public virtual bool IsHttpOnly /// /// Gets the SameSite setting for the cookie. /// - [JsonProperty("sameSite", NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("sameSite")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public virtual string SameSite { get { return this.sameSite; } @@ -235,6 +237,7 @@ public virtual string SameSite /// /// Gets the expiration date of the cookie. /// + [JsonIgnore] public DateTime? Expiry { get { return this.cookieExpiry; } @@ -245,7 +248,9 @@ public DateTime? Expiry /// /// This property only exists so that the JSON serializer can serialize a /// cookie without resorting to a custom converter. - [JsonProperty("expiry", NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("expiry")] + [JsonInclude] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] internal long? ExpirySeconds { get diff --git a/dotnet/src/webdriver/DevTools/DevToolsCommandData.cs b/dotnet/src/webdriver/DevTools/DevToolsCommandData.cs index 875af9fa9fa21..4f5ffd49f6f3e 100644 --- a/dotnet/src/webdriver/DevTools/DevToolsCommandData.cs +++ b/dotnet/src/webdriver/DevTools/DevToolsCommandData.cs @@ -16,8 +16,8 @@ // limitations under the License. // -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; using System.Threading; namespace OpenQA.Selenium.DevTools @@ -33,7 +33,7 @@ public class DevToolsCommandData /// The ID of the commmand execution. /// The method name of the DevTools command. /// The parameters of the DevTools command. - public DevToolsCommandData(long commandId, string commandName, JToken commandParameters) + public DevToolsCommandData(long commandId, string commandName, JsonNode commandParameters) : this(commandId, null, commandName, commandParameters) { } @@ -45,7 +45,7 @@ public DevToolsCommandData(long commandId, string commandName, JToken commandPar /// The session ID of the current command execution. /// The method name of the DevTools command. /// The parameters of the DevTools command. - public DevToolsCommandData(long commandId, string sessionId, string commandName, JToken commandParameters) + public DevToolsCommandData(long commandId, string sessionId, string commandName, JsonNode commandParameters) { CommandId = commandId; SessionId = sessionId; @@ -57,26 +57,27 @@ public DevToolsCommandData(long commandId, string sessionId, string commandName, /// /// Gets the session ID of the command. /// - [JsonProperty("sessionId", NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("sessionId")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string SessionId { get; } /// /// Gets the numeric ID of the command execution. /// - [JsonProperty("id")] + [JsonPropertyName("id")] public long CommandId { get; } /// /// Gets the method name of the command. /// - [JsonProperty("method")] + [JsonPropertyName("method")] public string CommandName { get; } /// /// Gets the parameters for the command. /// - [JsonProperty("params")] - public JToken CommandParameters { get; } + [JsonPropertyName("params")] + public JsonNode CommandParameters { get; } /// /// Gets a ManualResetEventSlim on which execution of the command can be synchronized. @@ -88,7 +89,7 @@ public DevToolsCommandData(long commandId, string sessionId, string commandName, /// Get or sets the result of the command execution. /// [JsonIgnore] - public JToken Result { get; set; } + public JsonNode Result { get; set; } /// /// Gets or sets a value indicating whether the command resulted in an error response. diff --git a/dotnet/src/webdriver/DevTools/DevToolsSession.cs b/dotnet/src/webdriver/DevTools/DevToolsSession.cs index cb84f28904fe4..825d31fe4fd7e 100644 --- a/dotnet/src/webdriver/DevTools/DevToolsSession.cs +++ b/dotnet/src/webdriver/DevTools/DevToolsSession.cs @@ -16,12 +16,12 @@ // limitations under the License. // -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using System; using System.Collections.Concurrent; using System.Globalization; using System.Net.Http; +using System.Text.Json; +using System.Text.Json.Nodes; using System.Threading; using System.Threading.Tasks; @@ -152,7 +152,7 @@ public T GetVersionSpecificDomains() where T : DevToolsSessionDomains throw new ArgumentNullException(nameof(command)); } - var result = await SendCommand(command.CommandName, JToken.FromObject(command), cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived).ConfigureAwait(false); + var result = await SendCommand(command.CommandName, JsonSerializer.SerializeToNode(command), cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived).ConfigureAwait(false); if (result == null) { @@ -164,7 +164,7 @@ public T GetVersionSpecificDomains() where T : DevToolsSessionDomains throw new InvalidOperationException($"Type {command.GetType()} does not correspond to a known command response type."); } - return result.ToObject(commandResponseType) as ICommandResponse; + return result.Deserialize(commandResponseType) as ICommandResponse; } /// @@ -185,7 +185,7 @@ public T GetVersionSpecificDomains() where T : DevToolsSessionDomains throw new ArgumentNullException(nameof(command)); } - var result = await SendCommand(command.CommandName, sessionId, JToken.FromObject(command), cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived).ConfigureAwait(false); + var result = await SendCommand(command.CommandName, sessionId, JsonSerializer.SerializeToNode(command), cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived).ConfigureAwait(false); if (result == null) { @@ -197,7 +197,7 @@ public T GetVersionSpecificDomains() where T : DevToolsSessionDomains throw new InvalidOperationException($"Type {typeof(TCommand)} does not correspond to a known command response type."); } - return result.ToObject(commandResponseType) as ICommandResponse; + return result.Deserialize(commandResponseType) as ICommandResponse; } /// @@ -219,27 +219,27 @@ public T GetVersionSpecificDomains() where T : DevToolsSessionDomains throw new ArgumentNullException(nameof(command)); } - var result = await SendCommand(command.CommandName, JToken.FromObject(command), cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived).ConfigureAwait(false); + var result = await SendCommand(command.CommandName, JsonSerializer.SerializeToNode(command), cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived).ConfigureAwait(false); if (result == null) { return default(TCommandResponse); } - return result.ToObject(); + return result.Deserialize(); } /// - /// Returns a JToken based on a command created with the specified command name and params. + /// Returns a JsonNode based on a command created with the specified command name and params. /// /// The name of the command to send. - /// The parameters of the command as a JToken object + /// The parameters of the command as a JsonNode object /// A CancellationToken object to allow for cancellation of the command. /// The execution timeout of the command in milliseconds. /// to throw an exception if a response is not received; otherwise, . /// The command response object implementing the interface. //[DebuggerStepThrough] - public async Task SendCommand(string commandName, JToken commandParameters, CancellationToken cancellationToken = default(CancellationToken), int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true) + public async Task SendCommand(string commandName, JsonNode commandParameters, CancellationToken cancellationToken = default(CancellationToken), int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true) { if (this.attachedTargetId == null) { @@ -251,17 +251,17 @@ public T GetVersionSpecificDomains() where T : DevToolsSessionDomains } /// - /// Returns a JToken based on a command created with the specified command name and params. + /// Returns a JsonNode based on a command created with the specified command name and params. /// /// The name of the command to send. /// The sessionId of the command. - /// The parameters of the command as a JToken object + /// The parameters of the command as a JsonNode object /// A CancellationToken object to allow for cancellation of the command. /// The execution timeout of the command in milliseconds. /// to throw an exception if a response is not received; otherwise, . /// The command response object implementing the interface. //[DebuggerStepThrough] - public async Task SendCommand(string commandName, string sessionId, JToken commandParameters, CancellationToken cancellationToken = default(CancellationToken), int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true) + public async Task SendCommand(string commandName, string sessionId, JsonNode commandParameters, CancellationToken cancellationToken = default(CancellationToken), int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true) { if (millisecondsTimeout.HasValue == false) { @@ -274,7 +274,7 @@ public T GetVersionSpecificDomains() where T : DevToolsSessionDomains { LogTrace("Sending {0} {1}: {2}", message.CommandId, message.CommandName, commandParameters.ToString()); - string contents = JsonConvert.SerializeObject(message); + string contents = JsonSerializer.Serialize(message); this.pendingCommands.TryAdd(message.CommandId, message); await this.connection.SendData(contents).ConfigureAwait(false); @@ -289,8 +289,8 @@ public T GetVersionSpecificDomains() where T : DevToolsSessionDomains { if (modified.IsError) { - var errorMessage = modified.Result.Value("message"); - var errorData = modified.Result.Value("data"); + var errorMessage = modified.Result["message"].GetValue(); + var errorData = modified.Result["data"]?.GetValue(); var exceptionMessage = $"{commandName}: {errorMessage}"; if (!string.IsNullOrWhiteSpace(errorData)) @@ -301,7 +301,7 @@ public T GetVersionSpecificDomains() where T : DevToolsSessionDomains LogTrace("Recieved Error Response {0}: {1} {2}", modified.CommandId, message, errorData); throw new CommandResponseException(exceptionMessage) { - Code = modified.Result.Value("code") + Code = modified.Result["code"].GetValue() }; } @@ -401,7 +401,7 @@ private async Task InitializeProtocol(int requestedProtocolVersion) rawVersionInfo = await client.GetStringAsync("/json/version").ConfigureAwait(false); } - var versionInfo = JsonConvert.DeserializeObject(rawVersionInfo); + var versionInfo = JsonSerializer.Deserialize(rawVersionInfo); this.websocketAddress = versionInfo.WebSocketDebuggerUrl; if (requestedProtocolVersion == AutoDetectDevToolsProtocolVersion) @@ -540,16 +540,16 @@ private void MonitorMessageQueue() private void ProcessMessage(string message) { - var messageObject = JObject.Parse(message); + var messageObject = JsonObject.Parse(message).AsObject(); - if (messageObject.TryGetValue("id", out var idProperty)) + if (messageObject.TryGetPropertyValue("id", out var idProperty)) { - var commandId = idProperty.Value(); + long commandId = (long)idProperty; DevToolsCommandData commandInfo; if (this.pendingCommands.TryGetValue(commandId, out commandInfo)) { - if (messageObject.TryGetValue("error", out var errorProperty)) + if (messageObject.TryGetPropertyValue("error", out var errorProperty)) { commandInfo.IsError = true; commandInfo.Result = errorProperty; @@ -570,9 +570,9 @@ private void ProcessMessage(string message) return; } - if (messageObject.TryGetValue("method", out var methodProperty)) + if (messageObject.TryGetPropertyValue("method", out var methodProperty)) { - var method = methodProperty.Value(); + var method = (string)methodProperty; var methodParts = method.Split(new char[] { '.' }, 2); var eventData = messageObject["params"]; diff --git a/dotnet/src/webdriver/DevTools/DevToolsSessionEventReceivedEventArgs.cs b/dotnet/src/webdriver/DevTools/DevToolsSessionEventReceivedEventArgs.cs index e4b55f6f80d8c..f34de5178d241 100644 --- a/dotnet/src/webdriver/DevTools/DevToolsSessionEventReceivedEventArgs.cs +++ b/dotnet/src/webdriver/DevTools/DevToolsSessionEventReceivedEventArgs.cs @@ -16,8 +16,8 @@ // limitations under the License. // -using Newtonsoft.Json.Linq; using System; +using System.Text.Json.Nodes; namespace OpenQA.Selenium.DevTools { @@ -32,7 +32,7 @@ public class DevToolsEventReceivedEventArgs : EventArgs /// The domain on which the event is to be raised. /// The name of the event to be raised. /// The data for the event to be raised. - public DevToolsEventReceivedEventArgs(string domainName, string eventName, JToken eventData) + public DevToolsEventReceivedEventArgs(string domainName, string eventName, JsonNode eventData) { DomainName = domainName; EventName = eventName; @@ -52,6 +52,6 @@ public DevToolsEventReceivedEventArgs(string domainName, string eventName, JToke /// /// Gets the data with which the event is to be raised. /// - public JToken EventData { get; private set; } + public JsonNode EventData { get; private set; } } } diff --git a/dotnet/src/webdriver/DevTools/DevToolsVersionInfo.cs b/dotnet/src/webdriver/DevTools/DevToolsVersionInfo.cs index 1cdfb269d792f..76420edcc9043 100644 --- a/dotnet/src/webdriver/DevTools/DevToolsVersionInfo.cs +++ b/dotnet/src/webdriver/DevTools/DevToolsVersionInfo.cs @@ -16,8 +16,8 @@ // limitations under the License. // -using Newtonsoft.Json; using System; +using System.Text.Json.Serialization; using System.Text.RegularExpressions; namespace OpenQA.Selenium.DevTools @@ -30,7 +30,8 @@ public class DevToolsVersionInfo /// /// Gets or sets the browser name, usually expressed as "Browser/Version" (e.g., "Chrome/86.0.0.1234". /// - [JsonProperty(PropertyName = "Browser")] + [JsonPropertyName("Browser")] + [JsonInclude] public string Browser { get; internal set; } /// @@ -48,19 +49,22 @@ public class DevToolsVersionInfo /// /// Gets the version of the Developer Tools Protocol. /// - [JsonProperty(PropertyName = "Protocol-Version")] + [JsonPropertyName("Protocol-Version")] + [JsonInclude] public string ProtocolVersion { get; internal set; } /// /// Gets the user agent string. /// - [JsonProperty(PropertyName = "User-Agent")] + [JsonPropertyName("User-Agent")] + [JsonInclude] public string UserAgent { get; internal set; } /// /// Gets the version string for the V8 script engine in use by this version of the browser. /// - [JsonProperty(PropertyName = "V8-Version")] + [JsonPropertyName("V8-Version")] + [JsonInclude] public string V8Version { get; @@ -70,7 +74,8 @@ public string V8Version /// /// Gets the URL for the WebSocket connection used for communicating via the DevTools Protocol. /// - [JsonProperty(PropertyName = "webSocketDebuggerUrl")] + [JsonPropertyName("webSocketDebuggerUrl")] + [JsonInclude] public string WebSocketDebuggerUrl { get; internal set; } /// @@ -96,7 +101,8 @@ public string V8VersionNumber /// /// Gets the version string for the version of WebKit used to build this version of the browser. /// - [JsonProperty(PropertyName = "WebKit-Version")] + [JsonPropertyName("WebKit-Version")] + [JsonInclude] public string WebKitVersion { get; internal set; } /// diff --git a/dotnet/src/webdriver/DevTools/IDevToolsSession.cs b/dotnet/src/webdriver/DevTools/IDevToolsSession.cs index 6c541cc99b4ba..bfe223580b925 100644 --- a/dotnet/src/webdriver/DevTools/IDevToolsSession.cs +++ b/dotnet/src/webdriver/DevTools/IDevToolsSession.cs @@ -15,8 +15,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Newtonsoft.Json.Linq; using System; +using System.Text.Json.Nodes; using System.Threading; using System.Threading.Tasks; @@ -74,14 +74,14 @@ Task SendCommand(TCommand command, where TCommandResponse : ICommandResponse; /// - /// Returns a JToken based on a command created with the specified command name and params. + /// Returns a JsonNode based on a command created with the specified command name and params. /// /// The name of the command to send. - /// The parameters of the command as a JToken object + /// The parameters of the command as a JsonNode object /// A CancellationToken object to allow for cancellation of the command. /// The execution timeout of the command in milliseconds. /// to throw an exception if a response is not received; otherwise, . /// The command response object implementing the interface. - Task SendCommand(string commandName, JToken @params, CancellationToken cancellationToken, int? millisecondsTimeout, bool throwExceptionIfResponseNotReceived); + Task SendCommand(string commandName, JsonNode @params, CancellationToken cancellationToken, int? millisecondsTimeout, bool throwExceptionIfResponseNotReceived); } } diff --git a/dotnet/src/webdriver/DevTools/Json/JsonEnumMemberConverter.cs b/dotnet/src/webdriver/DevTools/Json/JsonEnumMemberConverter.cs new file mode 100644 index 0000000000000..2ec7f4ae55723 --- /dev/null +++ b/dotnet/src/webdriver/DevTools/Json/JsonEnumMemberConverter.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace OpenQA.Selenium.DevTools.Json +{ + internal class JsonEnumMemberConverter : JsonConverter where TEnum : Enum + { + private readonly Dictionary _enumToString = new Dictionary(); + private readonly Dictionary _stringToEnum = new Dictionary(); + + public JsonEnumMemberConverter() + { + var type = typeof(TEnum); + var values = Enum.GetValues(type); + + foreach (var value in values) + { + var enumMember = type.GetMember(value.ToString())[0]; + var attr = enumMember.GetCustomAttributes(typeof(EnumMemberAttribute), false) + .Cast() + .FirstOrDefault(); + + _stringToEnum.Add(value.ToString(), (TEnum)value); + + if (attr?.Value != null) + { + _enumToString[(TEnum)value] = attr.Value; + _stringToEnum[attr.Value] = (TEnum)value; + } + else + { + _enumToString.Add((TEnum)value, value.ToString()); + } + } + } + + public override TEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var stringValue = reader.GetString(); + + if (_stringToEnum.TryGetValue(stringValue, out var enumValue)) + { + return enumValue; + } + + return default; + } + + public override void Write(Utf8JsonWriter writer, TEnum value, JsonSerializerOptions options) + { + writer.WriteStringValue(_enumToString[value]); + } + } +} diff --git a/dotnet/src/webdriver/DomMutationData.cs b/dotnet/src/webdriver/DomMutationData.cs index 9ee003c76c905..beaffd767d6fd 100644 --- a/dotnet/src/webdriver/DomMutationData.cs +++ b/dotnet/src/webdriver/DomMutationData.cs @@ -16,7 +16,7 @@ // limitations under the License. // -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace OpenQA.Selenium { @@ -33,7 +33,8 @@ public class DomMutationData /// /// Gets the ID of the element whose value is changing. /// - [JsonProperty(PropertyName = "target")] + [JsonPropertyName("target")] + [JsonInclude] public string TargetId { get { return this.targetId; } @@ -43,7 +44,8 @@ public string TargetId /// /// Gets the name of the attribute that is changing. /// - [JsonProperty(PropertyName = "name")] + [JsonPropertyName("name")] + [JsonInclude] public string AttributeName { get { return this.attributeName; } @@ -53,7 +55,8 @@ public string AttributeName /// /// Gets the value to which the attribute is being changed. /// - [JsonProperty(PropertyName = "value")] + [JsonPropertyName("value")] + [JsonInclude] public string AttributeValue { get { return this.attributeValue; } @@ -63,7 +66,8 @@ public string AttributeValue /// /// Gets the value from which the attribute has been changed. /// - [JsonProperty(PropertyName = "oldValue")] + [JsonPropertyName("oldValue")] + [JsonInclude] public string AttributeOriginalValue { get { return this.attributeOriginalValue; } diff --git a/dotnet/src/webdriver/DriverOptions.cs b/dotnet/src/webdriver/DriverOptions.cs index 9b40e32fbfbbe..1c871c6b29fde 100644 --- a/dotnet/src/webdriver/DriverOptions.cs +++ b/dotnet/src/webdriver/DriverOptions.cs @@ -16,12 +16,12 @@ // limitations under the License. // -using Newtonsoft.Json; using OpenQA.Selenium.Internal; using OpenQA.Selenium.Remote; using System; using System.Collections.Generic; using System.Globalization; +using System.Text.Json; namespace OpenQA.Selenium { @@ -395,7 +395,7 @@ public void SetLoggingPreference(string logType, LogLevel logLevel) /// A string representation of this . public override string ToString() { - return JsonConvert.SerializeObject(this.ToDictionary(), Formatting.Indented); + return JsonSerializer.Serialize(this.ToDictionary(), new JsonSerializerOptions { WriteIndented = true }); } /// diff --git a/dotnet/src/webdriver/Firefox/FirefoxExtension.cs b/dotnet/src/webdriver/Firefox/FirefoxExtension.cs index 89673f0e1e0ef..5af9ad5ca8c8b 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxExtension.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxExtension.cs @@ -16,12 +16,12 @@ // limitations under the License. // -using Newtonsoft.Json.Linq; using OpenQA.Selenium.Internal; using System; using System.Globalization; using System.IO; using System.IO.Compression; +using System.Text.Json.Nodes; using System.Xml; @@ -176,7 +176,7 @@ private static string ReadIdFromManifestJson(string root) { string id = null; string manifestJsonPath = Path.Combine(root, JsonManifestFileName); - var manifestObject = JObject.Parse(File.ReadAllText(manifestJsonPath)); + var manifestObject = JsonNode.Parse(File.ReadAllText(manifestJsonPath)); if (manifestObject["applications"] != null) { var applicationObject = manifestObject["applications"]; diff --git a/dotnet/src/webdriver/Firefox/FirefoxProfile.cs b/dotnet/src/webdriver/Firefox/FirefoxProfile.cs index 8d563f93c2969..2c19547bde5a9 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxProfile.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxProfile.cs @@ -16,12 +16,12 @@ // limitations under the License. // -using Newtonsoft.Json; using OpenQA.Selenium.Internal; using System; using System.Collections.Generic; using System.IO; using System.IO.Compression; +using System.Text.Json; namespace OpenQA.Selenium.Firefox { @@ -295,12 +295,20 @@ private void UpdateUserPreferences() private void ReadDefaultPreferences() { + var jsonSerializerOptions = new JsonSerializerOptions + { + Converters = + { + new ResponseValueJsonConverter() + } + }; + using (Stream defaultPrefsStream = ResourceUtilities.GetResourceStream("webdriver_prefs.json", "webdriver_prefs.json")) { using (StreamReader reader = new StreamReader(defaultPrefsStream)) { string defaultPreferences = reader.ReadToEnd(); - Dictionary deserializedPreferences = JsonConvert.DeserializeObject>(defaultPreferences, new ResponseValueJsonConverter()); + Dictionary deserializedPreferences = JsonSerializer.Deserialize>(defaultPreferences, jsonSerializerOptions); Dictionary immutableDefaultPreferences = deserializedPreferences["frozen"] as Dictionary; Dictionary editableDefaultPreferences = deserializedPreferences["mutable"] as Dictionary; this.profilePreferences = new Preferences(immutableDefaultPreferences, editableDefaultPreferences); diff --git a/dotnet/src/webdriver/Internal/ResponseValueJsonConverter.cs b/dotnet/src/webdriver/Internal/ResponseValueJsonConverter.cs index a421ddac802a3..9967d790c55c9 100644 --- a/dotnet/src/webdriver/Internal/ResponseValueJsonConverter.cs +++ b/dotnet/src/webdriver/Internal/ResponseValueJsonConverter.cs @@ -16,88 +16,90 @@ // limitations under the License. // -using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.Internal { /// /// Converts the response to JSON /// - internal class ResponseValueJsonConverter : JsonConverter + internal class ResponseValueJsonConverter : JsonConverter { - /// - /// Checks if the object can be converted - /// - /// The object to be converted - /// True if it can be converted or false if can't be - public override bool CanConvert(Type objectType) + public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - return true; + return this.ProcessToken(ref reader, options); } - /// - /// Process the reader to return an object from JSON - /// - /// A JSON reader - /// Type of the object - /// The existing value of the object - /// JSON Serializer - /// Object created from JSON - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options) { - return this.ProcessToken(reader); + JsonSerializer.Serialize(writer, value, options); } - /// - /// Writes objects to JSON. Currently not implemented - /// - /// JSON Writer Object - /// Value to be written - /// JSON Serializer - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - if (serializer != null) - { - serializer.Serialize(writer, value); - } - } - - private object ProcessToken(JsonReader reader) + private object ProcessToken(ref Utf8JsonReader reader, JsonSerializerOptions options) { // Recursively processes a token. This is required for elements that next other elements. object processedObject = null; - if (reader != null) + + if (reader.TokenType == JsonTokenType.StartObject) { - reader.DateParseHandling = DateParseHandling.None; - if (reader.TokenType == JsonToken.StartObject) + Dictionary dictionaryValue = new Dictionary(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) { - Dictionary dictionaryValue = new Dictionary(); - while (reader.Read() && reader.TokenType != JsonToken.EndObject) - { - string elementKey = reader.Value.ToString(); - reader.Read(); - dictionaryValue.Add(elementKey, this.ProcessToken(reader)); - } - - processedObject = dictionaryValue; + string elementKey = reader.GetString(); + reader.Read(); + dictionaryValue.Add(elementKey, this.ProcessToken(ref reader, options)); } - else if (reader.TokenType == JsonToken.StartArray) + + processedObject = dictionaryValue; + } + else if (reader.TokenType == JsonTokenType.StartArray) + { + List arrayValue = new List(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) { - List arrayValue = new List(); - while (reader.Read() && reader.TokenType != JsonToken.EndArray) - { - arrayValue.Add(this.ProcessToken(reader)); - } + arrayValue.Add(this.ProcessToken(ref reader, options)); + } - processedObject = arrayValue.ToArray(); + processedObject = arrayValue.ToArray(); + } + else if (reader.TokenType == JsonTokenType.Null) + { + processedObject = null; + } + else if (reader.TokenType == JsonTokenType.False) + { + processedObject = false; + } + else if (reader.TokenType == JsonTokenType.True) + { + processedObject = true; + } + else if (reader.TokenType == JsonTokenType.String) + { + processedObject = reader.GetString(); + } + else if (reader.TokenType == JsonTokenType.Number) + { + if (reader.TryGetInt64(out long longValue)) + { + processedObject = longValue; + } + else if (reader.TryGetDouble(out double doubleValue)) + { + processedObject = doubleValue; } else { - processedObject = reader.Value; + throw new JsonException($"Unrecognized '{JsonElement.ParseValue(ref reader)}' token as a number value."); } } + else + { + throw new JsonException($"Unrecognized '{reader.TokenType}' token type while parsing command response."); + } return processedObject; } diff --git a/dotnet/src/webdriver/Internal/ReturnedCapabilities.cs b/dotnet/src/webdriver/Internal/ReturnedCapabilities.cs index 9fb646a40f5de..5486efb4c9987 100644 --- a/dotnet/src/webdriver/Internal/ReturnedCapabilities.cs +++ b/dotnet/src/webdriver/Internal/ReturnedCapabilities.cs @@ -16,11 +16,11 @@ // limitations under the License. // -using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; +using System.Text.Json; namespace OpenQA.Selenium.Internal { @@ -153,7 +153,7 @@ public Dictionary ToDictionary() /// String of capabilities being used public override string ToString() { - return JsonConvert.SerializeObject(this.capabilities, Formatting.Indented); + return JsonSerializer.Serialize(this.capabilities, new JsonSerializerOptions { WriteIndented = true }); } } } diff --git a/dotnet/src/webdriver/JavaScriptEngine.cs b/dotnet/src/webdriver/JavaScriptEngine.cs index 2a63e12d7c82c..76f89bdf391d5 100644 --- a/dotnet/src/webdriver/JavaScriptEngine.cs +++ b/dotnet/src/webdriver/JavaScriptEngine.cs @@ -16,7 +16,6 @@ // limitations under the License. // -using Newtonsoft.Json; using OpenQA.Selenium.DevTools; using OpenQA.Selenium.Internal; using System; @@ -24,6 +23,7 @@ using System.Globalization; using System.IO; using System.Linq; +using System.Text.Json; using System.Threading.Tasks; namespace OpenQA.Selenium @@ -380,7 +380,7 @@ private void OnScriptBindingCalled(object sender, BindingCalledEventArgs e) { if (e.Name == MonitorBindingName) { - DomMutationData valueChangeData = JsonConvert.DeserializeObject(e.Payload); + DomMutationData valueChangeData = JsonSerializer.Deserialize(e.Payload); var locator = By.CssSelector($"*[data-__webdriver_id='{valueChangeData.TargetId}']"); valueChangeData.Element = driver.FindElements(locator).FirstOrDefault(); diff --git a/dotnet/src/webdriver/Proxy.cs b/dotnet/src/webdriver/Proxy.cs index c94f28755286e..1a696a7a48c46 100644 --- a/dotnet/src/webdriver/Proxy.cs +++ b/dotnet/src/webdriver/Proxy.cs @@ -16,11 +16,11 @@ // limitations under the License. // -using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; +using System.Text.Json.Serialization; namespace OpenQA.Selenium { @@ -67,7 +67,6 @@ public enum ProxyKind /// /// Describes proxy settings to be used with a driver instance. /// - [JsonObject(MemberSerialization.OptIn)] public class Proxy { private ProxyKind proxyKind = ProxyKind.Unspecified; @@ -204,7 +203,7 @@ public ProxyKind Kind /// /// Gets the type of proxy as a string for JSON serialization. /// - [JsonProperty("proxyType")] + [JsonPropertyName("proxyType")] public string SerializableProxyKind { get @@ -245,7 +244,8 @@ public bool IsAutoDetect /// /// Gets or sets the value of the proxy for the FTP protocol. /// - [JsonProperty("ftpProxy", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("ftpProxy")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string FtpProxy { get @@ -264,7 +264,8 @@ public string FtpProxy /// /// Gets or sets the value of the proxy for the HTTP protocol. /// - [JsonProperty("httpProxy", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("httpProxy")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string HttpProxy { get @@ -283,7 +284,8 @@ public string HttpProxy /// /// Gets the list of address for which to bypass the proxy as an array. /// - [JsonProperty("noProxy", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("noProxy")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public ReadOnlyCollection BypassProxyAddresses { get @@ -300,7 +302,8 @@ public ReadOnlyCollection BypassProxyAddresses /// /// Gets or sets the URL used for proxy automatic configuration. /// - [JsonProperty("proxyAutoconfigUrl", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("proxyAutoconfigUrl")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string ProxyAutoConfigUrl { get @@ -319,7 +322,8 @@ public string ProxyAutoConfigUrl /// /// Gets or sets the value of the proxy for the SSL protocol. /// - [JsonProperty("sslProxy", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("sslProxy")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string SslProxy { get @@ -338,7 +342,8 @@ public string SslProxy /// /// Gets or sets the value of the proxy for the SOCKS protocol. /// - [JsonProperty("socksProxy", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("socksProxy")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string SocksProxy { get @@ -357,7 +362,8 @@ public string SocksProxy /// /// Gets or sets the value of username for the SOCKS proxy. /// - [JsonProperty("socksUsername", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("socksUsername")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string SocksUserName { get @@ -377,7 +383,8 @@ public string SocksUserName /// Gets or sets the value of the protocol version for the SOCKS proxy. /// Value can be if not set. /// - [JsonProperty("socksVersion", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("socksVersion")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public int? SocksVersion { get @@ -408,7 +415,8 @@ public int? SocksVersion /// /// Gets or sets the value of password for the SOCKS proxy. /// - [JsonProperty("socksPassword", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)] + [JsonPropertyName("socksPassword")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string SocksPassword { get diff --git a/dotnet/src/webdriver/Remote/RemoteSessionSettings.cs b/dotnet/src/webdriver/Remote/RemoteSessionSettings.cs index b98777c401bc8..e3ee3359cca30 100644 --- a/dotnet/src/webdriver/Remote/RemoteSessionSettings.cs +++ b/dotnet/src/webdriver/Remote/RemoteSessionSettings.cs @@ -16,12 +16,12 @@ // limitations under the License. // -using Newtonsoft.Json; using OpenQA.Selenium.Remote; using System; using System.Collections; using System.Collections.Generic; using System.Globalization; +using System.Text.Json; namespace OpenQA.Selenium { @@ -276,7 +276,7 @@ public Dictionary ToDictionary() /// String representation of the remote session settings to be sent. public override string ToString() { - return JsonConvert.SerializeObject(this.ToDictionary(), Formatting.Indented); + return JsonSerializer.Serialize(this.ToDictionary(), new JsonSerializerOptions { WriteIndented = true }); } internal DriverOptions GetFirstMatchDriverOptions(int firstMatchIndex) diff --git a/dotnet/src/webdriver/Response.cs b/dotnet/src/webdriver/Response.cs index 2cbb0085b3ece..674a6488135b4 100644 --- a/dotnet/src/webdriver/Response.cs +++ b/dotnet/src/webdriver/Response.cs @@ -16,11 +16,11 @@ // limitations under the License. // -using Newtonsoft.Json; using OpenQA.Selenium.Internal; using System; using System.Collections.Generic; using System.Globalization; +using System.Text.Json; namespace OpenQA.Selenium { @@ -29,6 +29,11 @@ namespace OpenQA.Selenium /// public class Response { + private readonly static JsonSerializerOptions s_jsonSerializerOptions = new() + { + Converters = { new ResponseValueJsonConverter() } + }; + private object responseValue; private string responseSessionId; private WebDriverResult responseStatus; @@ -140,7 +145,7 @@ public WebDriverResult Status /// A object described by the JSON string. public static Response FromJson(string value) { - Dictionary deserializedResponse = JsonConvert.DeserializeObject>(value, new ResponseValueJsonConverter()); + Dictionary deserializedResponse = JsonSerializer.Deserialize>(value, s_jsonSerializerOptions); Response response = new Response(deserializedResponse); return response; } @@ -152,7 +157,7 @@ public static Response FromJson(string value) /// A object described by the JSON string. public static Response FromErrorJson(string value) { - Dictionary deserializedResponse = JsonConvert.DeserializeObject>(value, new ResponseValueJsonConverter()); + var deserializedResponse = JsonSerializer.Deserialize>(value, s_jsonSerializerOptions); var response = new Response(); @@ -178,6 +183,8 @@ public static Response FromErrorJson(string value) throw new WebDriverException($"The 'value > error' property is not a string{Environment.NewLine}{value}"); } + response.Value = deserializedResponse["value"]; + response.Status = WebDriverError.ResultFromError(errorObject.ToString()); return response; @@ -189,7 +196,7 @@ public static Response FromErrorJson(string value) /// A JSON-encoded string representing this object. public string ToJson() { - return JsonConvert.SerializeObject(this); + return JsonSerializer.Serialize(this); } /// diff --git a/dotnet/src/webdriver/SeleniumManager.cs b/dotnet/src/webdriver/SeleniumManager.cs index b0301d5900b74..5e365ede075b6 100644 --- a/dotnet/src/webdriver/SeleniumManager.cs +++ b/dotnet/src/webdriver/SeleniumManager.cs @@ -16,16 +16,15 @@ // limitations under the License. // -using Newtonsoft.Json; -using OpenQA.Selenium.Internal; using OpenQA.Selenium.Internal.Logging; using System; using System.Collections.Generic; using System.Diagnostics; -using System.Globalization; using System.IO; using System.Runtime.InteropServices; using System.Text; +using System.Text.Json; +using System.Text.Json.Nodes; namespace OpenQA.Selenium { @@ -87,7 +86,7 @@ public static Dictionary BinaryPaths(string arguments) argsBuilder.Append(" --debug"); } - Dictionary output = RunCommand(BinaryFullPath, argsBuilder.ToString()); + var output = RunCommand(BinaryFullPath, argsBuilder.ToString()); Dictionary binaryPaths = new Dictionary(); binaryPaths.Add("browser_path", (string)output["browser_path"]); binaryPaths.Add("driver_path", (string)output["driver_path"]); @@ -109,7 +108,7 @@ public static Dictionary BinaryPaths(string arguments) /// /// the standard output of the execution. /// - private static Dictionary RunCommand(string fileName, string arguments) + private static JsonNode RunCommand(string fileName, string arguments) { Process process = new Process(); process.StartInfo.FileName = BinaryFullPath; @@ -175,42 +174,47 @@ private static Dictionary RunCommand(string fileName, string arg } string output = outputBuilder.ToString().Trim(); - Dictionary result; + JsonNode resultJsonNode; try { - Dictionary deserializedOutput = JsonConvert.DeserializeObject>(output, new ResponseValueJsonConverter()); - result = deserializedOutput["result"] as Dictionary; + var deserializedOutput = JsonSerializer.Deserialize>(output); + resultJsonNode = deserializedOutput["result"]; } catch (Exception ex) { throw new WebDriverException($"Error deserializing Selenium Manager's response: {output}", ex); } - if (result.ContainsKey("logs")) + if (resultJsonNode["logs"] is not null) { - Dictionary logs = result["logs"] as Dictionary; - foreach (KeyValuePair entry in logs) + var logs = resultJsonNode["logs"]; + foreach (var entry in logs.AsArray()) { - switch (entry.Key) + switch (entry.GetPropertyName()) { case "WARN": if (_logger.IsEnabled(LogEventLevel.Warn)) { - _logger.Warn(entry.Value); + _logger.Warn(entry.GetValue()); } break; case "DEBUG": + if (_logger.IsEnabled(LogEventLevel.Debug)) + { + _logger.Debug(entry.GetValue()); + } + break; case "INFO": - if (_logger.IsEnabled(LogEventLevel.Debug) && (entry.Key == "DEBUG" || entry.Key == "INFO")) + if (_logger.IsEnabled(LogEventLevel.Info)) { - _logger.Debug(entry.Value); + _logger.Info(entry.GetValue()); } break; } } } - return result; + return resultJsonNode; } } } diff --git a/dotnet/src/webdriver/StackTraceElement.cs b/dotnet/src/webdriver/StackTraceElement.cs index 01ef49ad09186..ea78043b24334 100644 --- a/dotnet/src/webdriver/StackTraceElement.cs +++ b/dotnet/src/webdriver/StackTraceElement.cs @@ -16,9 +16,9 @@ // limitations under the License. // -using Newtonsoft.Json; using System.Collections.Generic; using System.Globalization; +using System.Text.Json.Serialization; namespace OpenQA.Selenium { @@ -76,7 +76,7 @@ public StackTraceElement(Dictionary elementAttributes) /// /// Gets or sets the value of the filename in the stack /// - [JsonProperty("fileName")] + [JsonPropertyName("fileName")] public string FileName { get { return this.fileName; } @@ -86,7 +86,7 @@ public string FileName /// /// Gets or sets the value of the Class name in the stack trace /// - [JsonProperty("className")] + [JsonPropertyName("className")] public string ClassName { get { return this.className; } @@ -96,7 +96,7 @@ public string ClassName /// /// Gets or sets the line number /// - [JsonProperty("lineNumber")] + [JsonPropertyName("lineNumber")] public int LineNumber { get { return this.lineNumber; } @@ -106,7 +106,7 @@ public int LineNumber /// /// Gets or sets the Method name in the stack trace /// - [JsonProperty("methodName")] + [JsonPropertyName("methodName")] public string MethodName { get { return this.methodName; } diff --git a/dotnet/src/webdriver/WebDriver.StrongNamed.nuspec b/dotnet/src/webdriver/WebDriver.StrongNamed.nuspec index 026e066e24718..9c7dea901536f 100644 --- a/dotnet/src/webdriver/WebDriver.StrongNamed.nuspec +++ b/dotnet/src/webdriver/WebDriver.StrongNamed.nuspec @@ -24,7 +24,10 @@ - + + + + @@ -36,6 +39,10 @@ + + + + diff --git a/dotnet/src/webdriver/WebDriver.csproj b/dotnet/src/webdriver/WebDriver.csproj index 4776d50ddec83..951e1f98b88db 100644 --- a/dotnet/src/webdriver/WebDriver.csproj +++ b/dotnet/src/webdriver/WebDriver.csproj @@ -1,10 +1,10 @@ - netstandard2.0 + netstandard2.0;net8.0; WebDriver OpenQA.Selenium - 10.0 + 12.0 @@ -51,8 +51,8 @@ - - + + diff --git a/dotnet/src/webdriver/WebDriver.nuspec b/dotnet/src/webdriver/WebDriver.nuspec index 70119ade10d35..b582625550670 100644 --- a/dotnet/src/webdriver/WebDriver.nuspec +++ b/dotnet/src/webdriver/WebDriver.nuspec @@ -24,7 +24,10 @@ - + + + + @@ -36,6 +39,10 @@ + + + + diff --git a/dotnet/test/chrome/WebDriver.Chrome.Tests.csproj b/dotnet/test/chrome/WebDriver.Chrome.Tests.csproj index 0d168ea50c237..145db60d14c50 100644 --- a/dotnet/test/chrome/WebDriver.Chrome.Tests.csproj +++ b/dotnet/test/chrome/WebDriver.Chrome.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 WebDriver.Chrome.Tests diff --git a/dotnet/test/common/BUILD.bazel b/dotnet/test/common/BUILD.bazel index 3173e82133f23..4c152aadf03c4 100644 --- a/dotnet/test/common/BUILD.bazel +++ b/dotnet/test/common/BUILD.bazel @@ -45,12 +45,12 @@ csharp_library( data = [ "//common/manager:selenium-manager-macos", ], - target_frameworks = ["net7.0"], + target_frameworks = ["net8.0"], visibility = [ "//dotnet/test:__subpackages__", ], deps = [ - "//dotnet/src/webdriver", + "//dotnet/src/webdriver:webdriver-net8.0", "@rules_dotnet//tools/runfiles", framework("nuget", "Newtonsoft.Json"), framework("nuget", "NUnit"), @@ -85,10 +85,10 @@ dotnet_nunit_test_suite( data = [ ":test-data", ], - target_frameworks = ["net7.0"], + target_frameworks = ["net8.0"], deps = [ ":fixtures", - "//dotnet/src/webdriver", + "//dotnet/src/webdriver:webdriver-net8.0", framework("nuget", "BenderProxy"), framework("nuget", "Newtonsoft.Json"), framework("nuget", "NUnit"), diff --git a/dotnet/test/common/ProxyTest.cs b/dotnet/test/common/ProxyTest.cs index 511d0faaf0b70..ebf2f00bbcd3a 100644 --- a/dotnet/test/common/ProxyTest.cs +++ b/dotnet/test/common/ProxyTest.cs @@ -1,5 +1,3 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using NUnit.Framework; using System.Collections.Generic; @@ -170,62 +168,6 @@ public void LongSocksVersionFromDictionary() Assert.That(proxy.SocksVersion, Is.EqualTo(intValue)); } - [Test] - public void ManualProxyToJson() - { - Proxy proxy = new Proxy(); - proxy.Kind = ProxyKind.Manual; - proxy.HttpProxy = "http.proxy:1234"; - proxy.FtpProxy = "ftp.proxy"; - proxy.SslProxy = "ssl.proxy"; - proxy.AddBypassAddresses("localhost", "127.0.0.*"); - proxy.SocksProxy = "socks.proxy:65555"; - proxy.SocksVersion = 5; - proxy.SocksUserName = "test1"; - proxy.SocksPassword = "test2"; - - string jsonValue = JsonConvert.SerializeObject(proxy); - JObject json = JObject.Parse(jsonValue); - - Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue); - Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String)); - Assert.That(json["proxyType"].Value(), Is.EqualTo("manual")); - - Assert.That(json.ContainsKey("ftpProxy"), Is.True); - Assert.That(json["ftpProxy"].Type, Is.EqualTo(JTokenType.String)); - Assert.That(json["ftpProxy"].Value(), Is.EqualTo("ftp.proxy")); - - Assert.That(json.ContainsKey("httpProxy"), Is.True); - Assert.That(json["httpProxy"].Type, Is.EqualTo(JTokenType.String)); - Assert.That(json["httpProxy"].Value(), Is.EqualTo("http.proxy:1234")); - - Assert.That(json.ContainsKey("sslProxy"), Is.True); - Assert.That(json["sslProxy"].Type, Is.EqualTo(JTokenType.String)); - Assert.That(json["sslProxy"].Value(), Is.EqualTo("ssl.proxy")); - - Assert.That(json.ContainsKey("socksProxy"), Is.True); - Assert.That(json["socksProxy"].Type, Is.EqualTo(JTokenType.String)); - Assert.That(json["socksProxy"].Value(), Is.EqualTo("socks.proxy:65555")); - - Assert.That(json.ContainsKey("socksVersion"), Is.True); - Assert.That(json["socksVersion"].Type, Is.EqualTo(JTokenType.Integer)); - Assert.That(json["socksVersion"].Value(), Is.EqualTo(5)); - - Assert.That(json.ContainsKey("socksUsername"), Is.True); - Assert.That(json["socksUsername"].Type, Is.EqualTo(JTokenType.String)); - Assert.That(json["socksUsername"].Value(), Is.EqualTo("test1")); - - Assert.That(json.ContainsKey("socksPassword"), Is.True); - Assert.That(json["socksPassword"].Type, Is.EqualTo(JTokenType.String)); - Assert.That(json["socksPassword"].Value(), Is.EqualTo("test2")); - - Assert.That(json.ContainsKey("noProxy"), Is.True); - Assert.That(json["noProxy"].Type, Is.EqualTo(JTokenType.Array)); - Assert.That(json["noProxy"].ToObject(), Is.EqualTo(new string[] { "localhost", "127.0.0.*" })); - - Assert.That(json.Count, Is.EqualTo(9)); - } - [Test] public void PacProxyFromDictionary() { @@ -249,27 +191,6 @@ public void PacProxyFromDictionary() Assert.That(proxy.IsAutoDetect, Is.False); } - [Test] - public void PacProxyToJson() - { - Proxy proxy = new Proxy(); - proxy.Kind = ProxyKind.ProxyAutoConfigure; - proxy.ProxyAutoConfigUrl = "http://aaa/bbb.pac"; - - string jsonValue = JsonConvert.SerializeObject(proxy); - JObject json = JObject.Parse(jsonValue); - - - Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue); - Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String), "proxyType is not a string - JSON = {0}", jsonValue); - Assert.That(json["proxyType"].Value(), Is.EqualTo("pac"), "proxyType not 'pac' - JSON = {0}", jsonValue); - - Assert.That(json.ContainsKey("proxyAutoconfigUrl"), Is.True); - Assert.That(json["proxyAutoconfigUrl"].Type, Is.EqualTo(JTokenType.String)); - Assert.That(json["proxyAutoconfigUrl"].Value(), Is.EqualTo("http://aaa/bbb.pac")); - Assert.That(json.Count, Is.EqualTo(2)); - } - [Test] public void AutoDetectProxyFromDictionary() { @@ -293,24 +214,6 @@ public void AutoDetectProxyFromDictionary() Assert.That(proxy.ProxyAutoConfigUrl, Is.Null); } - [Test] - public void AutoDetectProxyToJson() - { - Proxy proxy = new Proxy(); - proxy.Kind = ProxyKind.AutoDetect; - proxy.IsAutoDetect = true; - - JsonSerializerSettings settings = new JsonSerializerSettings(); - - string jsonValue = JsonConvert.SerializeObject(proxy); - JObject json = JObject.Parse(jsonValue); - - Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue); - Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String), "proxyType is not a string - JSON = {0}", jsonValue); - Assert.That(json["proxyType"].Value(), Is.EqualTo("autodetect"), "proxyType not 'autodetect' - JSON = {0}", jsonValue); - Assert.That(json.Count, Is.EqualTo(1), "more than one object in serialization - JSON = {0}", jsonValue); - } - [Test] public void SystemProxyFromDictionary() { @@ -333,21 +236,6 @@ public void SystemProxyFromDictionary() Assert.That(proxy.ProxyAutoConfigUrl, Is.Null); } - [Test] - public void SystemProxyToJson() - { - Proxy proxy = new Proxy(); - proxy.Kind = ProxyKind.System; - - string jsonValue = JsonConvert.SerializeObject(proxy); - JObject json = JObject.Parse(jsonValue); - - Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue); - Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String), "proxyType is not a string - JSON = {0}", jsonValue); - Assert.That(json["proxyType"].Value(), Is.EqualTo("system"), "proxyType not 'system' - JSON = {0}", jsonValue); - Assert.That(json.Count, Is.EqualTo(1), "more than one object in serialization - JSON = {0}", jsonValue); - } - [Test] public void DirectProxyFromDictionary() { @@ -370,21 +258,6 @@ public void DirectProxyFromDictionary() Assert.That(proxy.ProxyAutoConfigUrl, Is.Null); } - [Test] - public void DirectProxyToJson() - { - Proxy proxy = new Proxy(); - proxy.Kind = ProxyKind.Direct; - - string jsonValue = JsonConvert.SerializeObject(proxy); - JObject json = JObject.Parse(jsonValue); - - Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue); - Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String), "proxyType is not a string - JSON = {0}", jsonValue); - Assert.That(json["proxyType"].Value(), Is.EqualTo("direct"), "proxyType not 'direct' - JSON = {0}", jsonValue); - Assert.That(json.Count, Is.EqualTo(1), "more than one object in serialization - JSON = {0}", jsonValue); - } - [Test] public void ConstructingWithNullKeysWorksAsExpected() { diff --git a/dotnet/test/common/TakesScreenshotTest.cs b/dotnet/test/common/TakesScreenshotTest.cs index 0a6b4f6cefa71..2a567336b72b2 100644 --- a/dotnet/test/common/TakesScreenshotTest.cs +++ b/dotnet/test/common/TakesScreenshotTest.cs @@ -72,7 +72,7 @@ public void GetScreenshotAsBinary() [IgnoreBrowser(Browser.Firefox, "Not working properly in RBE, works locally with pinned browsers")] public void ShouldCaptureScreenshotOfCurrentViewport() { -#if NET6_0 +#if NET8_0 Assert.Ignore("Skipping test: this framework can not process colors."); #endif @@ -102,7 +102,7 @@ public void ShouldCaptureScreenshotOfCurrentViewport() [IgnoreBrowser(Browser.Edge, "Color comparisons fail on Edge")] public void ShouldTakeScreenshotsOfAnElement() { -#if NET6_0 || NET7_0 +#if NET8_0 Assert.Ignore("Skipping test: this framework can not process colors."); #endif @@ -131,7 +131,7 @@ public void ShouldTakeScreenshotsOfAnElement() [IgnoreBrowser(Browser.Edge, "Color comparisons fail on Edge")] public void ShouldCaptureScreenshotAtFramePage() { -#if NET6_0 || NET7_0 +#if NET8_0 Assert.Ignore("Skipping test: this framework can not process colors."); #endif @@ -176,7 +176,7 @@ public void ShouldCaptureScreenshotAtFramePage() [IgnoreBrowser(Browser.Edge, "Color comparisons fail on Edge")] public void ShouldCaptureScreenshotAtIFramePage() { -#if NET6_0 || NET7_0 +#if NET8_0 Assert.Ignore("Skipping test: this framework can not process colors."); #endif @@ -219,7 +219,7 @@ public void ShouldCaptureScreenshotAtIFramePage() [IgnoreBrowser(Browser.Edge, "Color comparisons fail on Edge")] public void ShouldCaptureScreenshotAtFramePageAfterSwitching() { -#if NET6_0 || NET7_0 +#if NET8_0 Assert.Ignore("Skipping test: this framework can not process colors."); #endif @@ -260,7 +260,7 @@ public void ShouldCaptureScreenshotAtFramePageAfterSwitching() [IgnoreBrowser(Browser.Edge, "Color comparisons fail on Edge")] public void ShouldCaptureScreenshotAtIFramePageAfterSwitching() { -#if NET6_0 || NET7_0 +#if NET6_0 || NET8_0 Assert.Ignore("Skipping test: this framework can not process colors."); #endif @@ -336,7 +336,7 @@ private HashSet ScanActualColors(Screenshot screenshot, int stepX, int s { HashSet colors = new HashSet(); -#if !NET6_0 && !NET7_0 +#if !NET8_0 try { Image image = Image.FromStream(new MemoryStream(screenshot.AsByteArray)); @@ -370,7 +370,7 @@ private Color GetPixelColor(Screenshot screenshot, int x, int y) { Color pixelColor = Color.Black; -#if !NET6_0 && !NET7_0 +#if !NET8_0 Image image = Image.FromStream(new MemoryStream(screenshot.AsByteArray)); Bitmap bitmap = new Bitmap(image); pixelColor = bitmap.GetPixel(1, 1); diff --git a/dotnet/test/common/WebDriver.Common.Tests.csproj b/dotnet/test/common/WebDriver.Common.Tests.csproj index 1a8c95ee51d79..720d0f36162d2 100644 --- a/dotnet/test/common/WebDriver.Common.Tests.csproj +++ b/dotnet/test/common/WebDriver.Common.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 WebDriver.Common.Tests OpenQA.Selenium diff --git a/dotnet/test/edge/WebDriver.Edge.Tests.csproj b/dotnet/test/edge/WebDriver.Edge.Tests.csproj index 411dd22b73e55..9d17837b8c25a 100644 --- a/dotnet/test/edge/WebDriver.Edge.Tests.csproj +++ b/dotnet/test/edge/WebDriver.Edge.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 WebDriver.Edge.Tests diff --git a/dotnet/test/firefox/WebDriver.Firefox.Tests.csproj b/dotnet/test/firefox/WebDriver.Firefox.Tests.csproj index e75039f3f4bb6..31ac9dfd5038b 100644 --- a/dotnet/test/firefox/WebDriver.Firefox.Tests.csproj +++ b/dotnet/test/firefox/WebDriver.Firefox.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 WebDriver.Firefox.Tests diff --git a/dotnet/test/ie/WebDriver.IE.Tests.csproj b/dotnet/test/ie/WebDriver.IE.Tests.csproj index 262410e1b705e..e3452847f9a13 100644 --- a/dotnet/test/ie/WebDriver.IE.Tests.csproj +++ b/dotnet/test/ie/WebDriver.IE.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 WebDriver.IE.Tests OpenQA.Selenium.IE diff --git a/dotnet/test/remote/WebDriver.Remote.Tests.csproj b/dotnet/test/remote/WebDriver.Remote.Tests.csproj index 56edf029a66a3..11f79e8e54048 100644 --- a/dotnet/test/remote/WebDriver.Remote.Tests.csproj +++ b/dotnet/test/remote/WebDriver.Remote.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 WebDriver.Remote.Tests diff --git a/dotnet/test/safari/WebDriver.Safari.Tests.csproj b/dotnet/test/safari/WebDriver.Safari.Tests.csproj index 1700c54bcf225..f1b5344e87260 100644 --- a/dotnet/test/safari/WebDriver.Safari.Tests.csproj +++ b/dotnet/test/safari/WebDriver.Safari.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 WebDriver.Safari.Tests diff --git a/dotnet/test/support/WebDriver.Support.Tests.csproj b/dotnet/test/support/WebDriver.Support.Tests.csproj index 7fb4107b4b938..f44ce5f28e756 100644 --- a/dotnet/test/support/WebDriver.Support.Tests.csproj +++ b/dotnet/test/support/WebDriver.Support.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 WebDriver.Support.Tests diff --git a/third_party/dotnet/devtools/src/generator/Templates/command.hbs b/third_party/dotnet/devtools/src/generator/Templates/command.hbs index d6bbd80320fec..d1e9ce1a9064d 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/command.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/command.hbs @@ -1,7 +1,7 @@ // namespace {{rootNamespace}}.{{domain.Name}} { - using Newtonsoft.Json; + using System.Text.Json.Serialization; /// /// {{xml-code-comment command.Description 1}} @@ -29,7 +29,8 @@ namespace {{rootNamespace}}.{{domain.Name}} /// Gets or sets the {{Name}} /// {{/if}} - [JsonProperty("{{Name}}"{{#if Optional}}, DefaultValueHandling = DefaultValueHandling.Ignore{{/if}})] + [JsonPropertyName("{{Name}}")] + {{#if Optional}}[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]{{/if}} public {{typemap ../context}} {{dehumanize Name}} { get; @@ -53,7 +54,8 @@ namespace {{rootNamespace}}.{{domain.Name}} /// Gets or sets the {{Name}} /// {{/if}} - [JsonProperty("{{Name}}"{{#if Optional}}, DefaultValueHandling = DefaultValueHandling.Ignore{{/if}})] + [JsonPropertyName("{{Name}}")] + {{#if Optional}}[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]{{/if}} public {{typemap ../context}} {{dehumanize Name}} { get; diff --git a/third_party/dotnet/devtools/src/generator/Templates/domain.hbs b/third_party/dotnet/devtools/src/generator/Templates/domain.hbs index e644657260771..1fc6271239b39 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/domain.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/domain.hbs @@ -3,6 +3,7 @@ namespace {{rootNamespace}}.{{domain.Name}} { using System; using System.Collections.Generic; + using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -60,7 +61,7 @@ namespace {{rootNamespace}}.{{domain.Name}} if (m_eventMap.ContainsKey(e.EventName)) { var eventData = m_eventMap[e.EventName]; - var eventArgs = e.EventData.ToObject(eventData.EventArgsType); + var eventArgs = e.EventData.Deserialize(eventData.EventArgsType); eventData.EventInvoker(eventArgs); } } diff --git a/third_party/dotnet/devtools/src/generator/Templates/event.hbs b/third_party/dotnet/devtools/src/generator/Templates/event.hbs index 666bf7d6cf909..5707d3be5c85f 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/event.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/event.hbs @@ -1,8 +1,8 @@ -// +// namespace {{rootNamespace}}.{{domain.Name}} { using System; - using Newtonsoft.Json; + using System.Text.Json.Serialization; /// /// {{xml-code-comment event.Description 1}} @@ -19,7 +19,8 @@ namespace {{rootNamespace}}.{{domain.Name}} /// Gets or sets the {{Name}} /// {{/if}} - [JsonProperty("{{Name}}"{{#if Optional}}, DefaultValueHandling = DefaultValueHandling.Ignore{{/if}})] + [JsonPropertyName("{{Name}}")] + {{#if Optional}}[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]{{/if}} public {{typemap ../context}} {{dehumanize Name}} { get; @@ -27,4 +28,4 @@ namespace {{rootNamespace}}.{{domain.Name}} } {{/each}} } -} \ No newline at end of file +} diff --git a/third_party/dotnet/devtools/src/generator/Templates/type-enum.hbs b/third_party/dotnet/devtools/src/generator/Templates/type-enum.hbs index ee9c77d4c8e2a..a22cb967b80d3 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/type-enum.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/type-enum.hbs @@ -1,14 +1,13 @@ // namespace {{rootNamespace}}.{{domain.Name}} { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; using System.Runtime.Serialization; + using System.Text.Json.Serialization; /// /// {{xml-code-comment type.Description 1}} /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(OpenQA.Selenium.DevTools.Json.JsonEnumMemberConverter<{{className}}>))] public enum {{className}} { {{#each type.Enum}} diff --git a/third_party/dotnet/devtools/src/generator/Templates/type-hash.hbs b/third_party/dotnet/devtools/src/generator/Templates/type-hash.hbs index ab16e6b5f73ce..7e5efc22ed8d1 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/type-hash.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/type-hash.hbs @@ -12,7 +12,8 @@ namespace {{rootNamespace}}.{{domain.Name}} /// /// {{xml-code-comment Description 2}} /// - [JsonProperty("{{Name}}"{{#if Optional}}, DefaultValueHandling = DefaultValueHandling.Ignore{{/if}})] + [JsonPropertyName("{{Name}}")] + {{#if Optional}}[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]{{/if}} public {{typemap ../context}} {{dehumanize Name}} { get; diff --git a/third_party/dotnet/devtools/src/generator/Templates/type-object.hbs b/third_party/dotnet/devtools/src/generator/Templates/type-object.hbs index 44fd327953027..fc9582431ad97 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/type-object.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/type-object.hbs @@ -1,7 +1,7 @@ // namespace {{rootNamespace}}.{{domain.Name}} { - using Newtonsoft.Json; + using System.Text.Json.Serialization; /// /// {{xml-code-comment type.Description 1}} @@ -12,7 +12,8 @@ namespace {{rootNamespace}}.{{domain.Name}} /// /// {{xml-code-comment Description 2}} /// - [JsonProperty("{{Name}}"{{#if Optional}}, DefaultValueHandling = DefaultValueHandling.Ignore{{/if}})] + [JsonPropertyName("{{Name}}")] + {{#if Optional}}[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]{{/if}} public {{typemap ../context}} {{dehumanize Name}} { get;