From 8aa8e9c328e0c2309d4d638896d11f04ec644787 Mon Sep 17 00:00:00 2001 From: Michael Render Date: Wed, 26 Nov 2025 00:38:54 -0500 Subject: [PATCH 1/2] [dotnet] Remove Newtonsoft.Json test-only dependency --- dotnet/paket.dependencies | 1 - dotnet/paket.lock | 1 - dotnet/paket.nuget.bzl | 1 - dotnet/test/common/BUILD.bazel | 2 -- .../test/common/Environment/DriverConfig.cs | 11 ++------ .../common/Environment/EnvironmentManager.cs | 4 +-- .../SeleniumTestSerializerContext.cs | 27 +++++++++++++++++++ .../common/Environment/TestEnvironment.cs | 10 ------- .../common/Environment/TestWebServerConfig.cs | 7 ++--- dotnet/test/common/Environment/UrlBuilder.cs | 6 ++--- .../test/common/Environment/WebsiteConfig.cs | 8 ------ .../Selenium.WebDriver.Common.Tests.csproj | 1 - .../src/generator/Templates/project.hbs | 6 +---- 13 files changed, 37 insertions(+), 48 deletions(-) create mode 100644 dotnet/test/common/Environment/SeleniumTestSerializerContext.cs diff --git a/dotnet/paket.dependencies b/dotnet/paket.dependencies index 598e88fc58d25..792dbbe778318 100644 --- a/dotnet/paket.dependencies +++ b/dotnet/paket.dependencies @@ -10,7 +10,6 @@ nuget Humanizer.Core 2.8.26 nuget Microsoft.Extensions.DependencyInjection 3.1.9 nuget Moq 4.20.72 nuget NETStandard.Library 2.0.3 -nuget Newtonsoft.Json 13.0.1 nuget NUnit 3.13.2 nuget NUnitLite 3.13.2 nuget System.Text.Json 8.0.5 diff --git a/dotnet/paket.lock b/dotnet/paket.lock index b9b91eab3d021..3c4c433dee49d 100644 --- a/dotnet/paket.lock +++ b/dotnet/paket.lock @@ -29,7 +29,6 @@ NUGET System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (== net462) (&& (== net8.0) (>= net462)) (&& (== net8.0) (< netstandard2.1)) (== netstandard2.0) NETStandard.Library (2.0.3) Microsoft.NETCore.Platforms (>= 1.1) - Newtonsoft.Json (13.0.1) NUnit (3.13.2) NETStandard.Library (>= 2.0) - restriction: || (&& (== net462) (< net35) (>= netstandard2.0)) (== net8.0) (== netstandard2.0) NUnitLite (3.13.2) diff --git a/dotnet/paket.nuget.bzl b/dotnet/paket.nuget.bzl index f8c546859238a..aa4ead5667dcd 100644 --- a/dotnet/paket.nuget.bzl +++ b/dotnet/paket.nuget.bzl @@ -19,7 +19,6 @@ def nuget(): {"name": "Microsoft.NETCore.Platforms", "id": "Microsoft.NETCore.Platforms", "version": "1.1.0", "sha512": "sha512-a/iSwnRZb+LHFk49hQOyThh/ZNC3vsbZsF65XwQIb863qF6msmhdQtxGXFL28Ob2NsCz/drEj28BJd/YPpLRBg==", "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": [], "net9.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": []}, {"name": "Moq", "id": "Moq", "version": "4.20.72", "sha512": "sha512-HeLdAKzFe2G4fUg+tUa1WRf/Mye9zbkiv57jHRSb5IVi7GXVPgWbbEaUP8SaOpt43JJFRlWY9N5Yro32/tgRpQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": [], "net451": [], "net452": [], "net46": [], "net461": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net462": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net47": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net471": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net472": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net48": ["Castle.Core", "System.Threading.Tasks.Extensions"], "net5.0": ["Castle.Core"], "net6.0": ["Castle.Core"], "net7.0": ["Castle.Core"], "net8.0": ["Castle.Core"], "net9.0": ["Castle.Core"], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["Castle.Core", "System.Threading.Tasks.Extensions"], "netcoreapp2.1": ["Castle.Core", "System.Threading.Tasks.Extensions"], "netcoreapp2.2": ["Castle.Core", "System.Threading.Tasks.Extensions"], "netcoreapp3.0": ["Castle.Core"], "netcoreapp3.1": ["Castle.Core"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["Castle.Core", "System.Threading.Tasks.Extensions"], "netstandard2.1": ["Castle.Core"]}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "NETStandard.Library", "id": "NETStandard.Library", "version": "2.0.3", "sha512": "sha512-548M6mnBSJWxsIlkQHfbzoYxpiYFXZZSL00p4GHYv8PkiqFBnnT68mW5mGEsA/ch9fDO9GkPgkFQpWiXZN7mAQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": [], "net40": [], "net403": [], "net45": ["Microsoft.NETCore.Platforms"], "net451": ["Microsoft.NETCore.Platforms"], "net452": ["Microsoft.NETCore.Platforms"], "net46": ["Microsoft.NETCore.Platforms"], "net461": ["Microsoft.NETCore.Platforms"], "net462": ["Microsoft.NETCore.Platforms"], "net47": ["Microsoft.NETCore.Platforms"], "net471": ["Microsoft.NETCore.Platforms"], "net472": ["Microsoft.NETCore.Platforms"], "net48": ["Microsoft.NETCore.Platforms"], "net5.0": ["Microsoft.NETCore.Platforms"], "net6.0": ["Microsoft.NETCore.Platforms"], "net7.0": ["Microsoft.NETCore.Platforms"], "net8.0": ["Microsoft.NETCore.Platforms"], "net9.0": ["Microsoft.NETCore.Platforms"], "netcoreapp1.0": ["Microsoft.NETCore.Platforms"], "netcoreapp1.1": ["Microsoft.NETCore.Platforms"], "netcoreapp2.0": ["Microsoft.NETCore.Platforms"], "netcoreapp2.1": ["Microsoft.NETCore.Platforms"], "netcoreapp2.2": ["Microsoft.NETCore.Platforms"], "netcoreapp3.0": ["Microsoft.NETCore.Platforms"], "netcoreapp3.1": ["Microsoft.NETCore.Platforms"], "netstandard": [], "netstandard1.0": ["Microsoft.NETCore.Platforms"], "netstandard1.1": ["Microsoft.NETCore.Platforms"], "netstandard1.2": ["Microsoft.NETCore.Platforms"], "netstandard1.3": ["Microsoft.NETCore.Platforms"], "netstandard1.4": ["Microsoft.NETCore.Platforms"], "netstandard1.5": ["Microsoft.NETCore.Platforms"], "netstandard1.6": ["Microsoft.NETCore.Platforms"], "netstandard2.0": ["Microsoft.NETCore.Platforms"], "netstandard2.1": ["Microsoft.NETCore.Platforms"]}, "targeting_pack_overrides": [], "framework_list": []}, - {"name": "Newtonsoft.Json", "id": "Newtonsoft.Json", "version": "13.0.1", "sha512": "sha512-g3MbZi6vBTeaI/hEbvR7vBETSd1DWLe9i1E4P+nPY34v5i94zqUqDXvdWC3G+7tYN9SnsdU9zzegrnRz4h7nsQ==", "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": [], "net9.0": [], "netcoreapp1.0": ["Microsoft.CSharp", "NETStandard.Library"], "netcoreapp1.1": ["Microsoft.CSharp", "NETStandard.Library"], "netcoreapp2.0": [], "netcoreapp2.1": [], "netcoreapp2.2": [], "netcoreapp3.0": [], "netcoreapp3.1": [], "netstandard": [], "netstandard1.0": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.1": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.2": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.3": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.4": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.5": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard1.6": ["Microsoft.CSharp", "NETStandard.Library"], "netstandard2.0": [], "netstandard2.1": []}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "NUnit", "id": "NUnit", "version": "3.13.2", "sha512": "sha512-foKGnF2ckq6uRAybnw1PIMDsDxdp1rbuEBJ4t2LYa5HDL80mOcEUjdbVqRDMTsKNiikfkPEBoeyGV42ZXiLLQA==", "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": ["NETStandard.Library"], "net6.0": ["NETStandard.Library"], "net7.0": ["NETStandard.Library"], "net8.0": ["NETStandard.Library"], "net9.0": ["NETStandard.Library"], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["NETStandard.Library"], "netcoreapp2.1": ["NETStandard.Library"], "netcoreapp2.2": ["NETStandard.Library"], "netcoreapp3.0": ["NETStandard.Library"], "netcoreapp3.1": ["NETStandard.Library"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["NETStandard.Library"], "netstandard2.1": ["NETStandard.Library"]}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "NUnitLite", "id": "NUnitLite", "version": "3.13.2", "sha512": "sha512-kPGW4B0ycZAqDPLPKU058JR9onD3svLKAYEghQ1Oyy1YC8bIgtniGUKUbjqeNI3i5KnqFMxEdiHTGF0XxDG9hQ==", "sources": ["https://api.nuget.org/v3/index.json"], "dependencies": {"net11": [], "net20": [], "net30": [], "net35": ["NUnit"], "net40": ["NUnit"], "net403": ["NUnit"], "net45": ["NUnit"], "net451": ["NUnit"], "net452": ["NUnit"], "net46": ["NUnit"], "net461": ["NUnit"], "net462": ["NUnit"], "net47": ["NUnit"], "net471": ["NUnit"], "net472": ["NUnit"], "net48": ["NUnit"], "net5.0": ["NUnit", "NETStandard.Library"], "net6.0": ["NUnit", "NETStandard.Library"], "net7.0": ["NUnit", "NETStandard.Library"], "net8.0": ["NUnit", "NETStandard.Library"], "net9.0": ["NUnit", "NETStandard.Library"], "netcoreapp1.0": [], "netcoreapp1.1": [], "netcoreapp2.0": ["NUnit", "NETStandard.Library"], "netcoreapp2.1": ["NUnit", "NETStandard.Library"], "netcoreapp2.2": ["NUnit", "NETStandard.Library"], "netcoreapp3.0": ["NUnit", "NETStandard.Library"], "netcoreapp3.1": ["NUnit", "NETStandard.Library"], "netstandard": [], "netstandard1.0": [], "netstandard1.1": [], "netstandard1.2": [], "netstandard1.3": [], "netstandard1.4": [], "netstandard1.5": [], "netstandard1.6": [], "netstandard2.0": ["NUnit", "NETStandard.Library"], "netstandard2.1": ["NUnit", "NETStandard.Library"]}, "targeting_pack_overrides": [], "framework_list": []}, {"name": "Runfiles", "id": "Runfiles", "version": "0.14.0", "sha512": "sha512-xncDBZgH/5m3QXFXxTOSQiooXZrEhU9hPThejXvnCmFpGrXYKWq5xWzM3Lp8sL33pTWnuWySnrdIyu5W6DZDiQ==", "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": [], "net9.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": []}, diff --git a/dotnet/test/common/BUILD.bazel b/dotnet/test/common/BUILD.bazel index 8f75f7858ea46..2ec48afa81136 100644 --- a/dotnet/test/common/BUILD.bazel +++ b/dotnet/test/common/BUILD.bazel @@ -52,7 +52,6 @@ csharp_library( ], deps = [ "//dotnet/src/webdriver:webdriver-net8.0", - nuget_package("Newtonsoft.Json"), nuget_package("NUnit"), nuget_package("Runfiles"), ], @@ -91,7 +90,6 @@ dotnet_nunit_test_suite( ":fixtures", "//dotnet/src/webdriver:webdriver-net8.0", nuget_package("BenderProxy"), - nuget_package("Newtonsoft.Json"), nuget_package("NUnit"), nuget_package("Runfiles"), ], diff --git a/dotnet/test/common/Environment/DriverConfig.cs b/dotnet/test/common/Environment/DriverConfig.cs index 31905d2a9b97c..2f7d638b3b662 100644 --- a/dotnet/test/common/Environment/DriverConfig.cs +++ b/dotnet/test/common/Environment/DriverConfig.cs @@ -17,27 +17,20 @@ // under the License. // -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.Environment; -[JsonObject] public class DriverConfig { - [JsonProperty] public string DriverTypeName { get; set; } - [JsonProperty] - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public Browser BrowserValue { get; set; } - [JsonProperty] public string RemoteCapabilities { get; set; } - [JsonProperty] public bool AutoStartRemoteServer { get; set; } - [JsonProperty] public bool Logging { get; set; } } diff --git a/dotnet/test/common/Environment/EnvironmentManager.cs b/dotnet/test/common/Environment/EnvironmentManager.cs index 380871e2f79b6..c384f15c8e32a 100644 --- a/dotnet/test/common/Environment/EnvironmentManager.cs +++ b/dotnet/test/common/Environment/EnvironmentManager.cs @@ -18,13 +18,13 @@ // using Bazel; -using Newtonsoft.Json; using NUnit.Framework; using OpenQA.Selenium.Internal; using System; using System.IO; using System.Linq; using System.Runtime.InteropServices; +using System.Text.Json; namespace OpenQA.Selenium.Environment; @@ -56,7 +56,7 @@ private EnvironmentManager() string currentDirectory = this.CurrentDirectory; string content = File.ReadAllText(dataFilePath); - TestEnvironment env = JsonConvert.DeserializeObject(content); + TestEnvironment env = JsonSerializer.Deserialize(content, SeleniumTestSerializerContext.Default.TestEnvironment); string activeDriverConfig = System.Environment.GetEnvironmentVariable("ACTIVE_DRIVER_CONFIG") ?? TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig); string driverServiceLocation = System.Environment.GetEnvironmentVariable("DRIVER_SERVICE_LOCATION") ?? TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation); diff --git a/dotnet/test/common/Environment/SeleniumTestSerializerContext.cs b/dotnet/test/common/Environment/SeleniumTestSerializerContext.cs new file mode 100644 index 0000000000000..906617b74b536 --- /dev/null +++ b/dotnet/test/common/Environment/SeleniumTestSerializerContext.cs @@ -0,0 +1,27 @@ +// +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + + +using System.Text.Json.Serialization; + +namespace OpenQA.Selenium.Environment; + +[JsonSerializable(typeof(TestEnvironment))] +[JsonSourceGenerationOptions(PropertyNameCaseInsensitive = true)] +internal sealed partial class SeleniumTestSerializerContext : JsonSerializerContext; diff --git a/dotnet/test/common/Environment/TestEnvironment.cs b/dotnet/test/common/Environment/TestEnvironment.cs index 93f4551d43fd8..017424d61f703 100644 --- a/dotnet/test/common/Environment/TestEnvironment.cs +++ b/dotnet/test/common/Environment/TestEnvironment.cs @@ -17,35 +17,25 @@ // under the License. // -using Newtonsoft.Json; using System.Collections.Generic; namespace OpenQA.Selenium.Environment; -[JsonObject] class TestEnvironment { - [JsonProperty] public bool CaptureWebServerOutput { get; set; } - [JsonProperty] public string DriverServiceLocation { get; set; } - [JsonProperty] public bool HideWebServerCommandPrompt { get; set; } - [JsonProperty] public string ActiveDriverConfig { get; set; } - [JsonProperty] public string ActiveWebsiteConfig { get; set; } - [JsonProperty] public Dictionary WebSiteConfigs { get; set; } - [JsonProperty] public Dictionary DriverConfigs { get; set; } - [JsonProperty] public TestWebServerConfig TestWebServerConfig { get; set; } } diff --git a/dotnet/test/common/Environment/TestWebServerConfig.cs b/dotnet/test/common/Environment/TestWebServerConfig.cs index 50c97f1c83f5e..cd0d73101283f 100644 --- a/dotnet/test/common/Environment/TestWebServerConfig.cs +++ b/dotnet/test/common/Environment/TestWebServerConfig.cs @@ -17,21 +17,18 @@ // under the License. // -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.Environment; -[JsonObject] public class TestWebServerConfig { - [JsonProperty] public bool CaptureConsoleOutput { get; set; } - [JsonProperty] public bool HideCommandPromptWindow { get; set; } - [JsonProperty] public string JavaHomeDirectory { get; set; } + [JsonIgnore] public string Port { get; set; } } diff --git a/dotnet/test/common/Environment/UrlBuilder.cs b/dotnet/test/common/Environment/UrlBuilder.cs index d9bb5cfc0d96e..35ec2fe27e059 100644 --- a/dotnet/test/common/Environment/UrlBuilder.cs +++ b/dotnet/test/common/Environment/UrlBuilder.cs @@ -17,13 +17,13 @@ // under the License. // -using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Net.Sockets; using System.Text; +using System.Text.Json.Nodes; namespace OpenQA.Selenium.Environment; @@ -125,12 +125,12 @@ public string CreateInlinePage(InlinePage page) { Uri createPageUri = new Uri(new Uri(WhereIs(string.Empty)), "createPage"); - Dictionary payloadDictionary = new Dictionary + var payloadDictionary = new JsonObject { ["content"] = page.ToString() }; - string commandPayload = JsonConvert.SerializeObject(payloadDictionary); + string commandPayload = payloadDictionary.ToJsonString(); using var httpClient = new HttpClient(); diff --git a/dotnet/test/common/Environment/WebsiteConfig.cs b/dotnet/test/common/Environment/WebsiteConfig.cs index fe3b148345067..ca11feb04d454 100644 --- a/dotnet/test/common/Environment/WebsiteConfig.cs +++ b/dotnet/test/common/Environment/WebsiteConfig.cs @@ -17,25 +17,17 @@ // under the License. // -using Newtonsoft.Json; - namespace OpenQA.Selenium.Environment; -[JsonObject] public class WebsiteConfig { - [JsonProperty] public string Protocol { get; set; } - [JsonProperty] public string HostName { get; set; } - [JsonProperty] public string Port { get; set; } - [JsonProperty] public string SecurePort { get; set; } - [JsonProperty] public string Folder { get; set; } } diff --git a/dotnet/test/common/Selenium.WebDriver.Common.Tests.csproj b/dotnet/test/common/Selenium.WebDriver.Common.Tests.csproj index 042384fd1fba0..7592b3d099963 100644 --- a/dotnet/test/common/Selenium.WebDriver.Common.Tests.csproj +++ b/dotnet/test/common/Selenium.WebDriver.Common.Tests.csproj @@ -10,7 +10,6 @@ - diff --git a/third_party/dotnet/devtools/src/generator/Templates/project.hbs b/third_party/dotnet/devtools/src/generator/Templates/project.hbs index 9768e1a26126c..31c3675ff4ad0 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/project.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/project.hbs @@ -1,4 +1,4 @@ -// +// net45;net46;net47;netstandard2.0 @@ -16,8 +16,4 @@ .Net Core based runtime to interact with an running instance of Chrome via the ChromeDevTools protocol. Chrome Version: {{chromeVersion.BrowserVersion}}; Protocol Version: {{chromeVersion.ProtocolVersion}};{{#if runtimeVersion}} Runtime Version: {{runtimeVersion}};{{/if}} - - - - From 5e4c74f9acacbb01b66420269ac18190409957d7 Mon Sep 17 00:00:00 2001 From: Michael Render Date: Wed, 26 Nov 2025 01:25:13 -0500 Subject: [PATCH 2/2] [dotnet] Remove source generator, it seems to fail in the non-common test runs --- .../common/Environment/EnvironmentManager.cs | 5 +++- .../SeleniumTestSerializerContext.cs | 27 ------------------- 2 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 dotnet/test/common/Environment/SeleniumTestSerializerContext.cs diff --git a/dotnet/test/common/Environment/EnvironmentManager.cs b/dotnet/test/common/Environment/EnvironmentManager.cs index c384f15c8e32a..9aed4a7ba4e72 100644 --- a/dotnet/test/common/Environment/EnvironmentManager.cs +++ b/dotnet/test/common/Environment/EnvironmentManager.cs @@ -56,7 +56,10 @@ private EnvironmentManager() string currentDirectory = this.CurrentDirectory; string content = File.ReadAllText(dataFilePath); - TestEnvironment env = JsonSerializer.Deserialize(content, SeleniumTestSerializerContext.Default.TestEnvironment); + TestEnvironment env = JsonSerializer.Deserialize(content, new JsonSerializerOptions + { + PropertyNameCaseInsensitive = true + }); string activeDriverConfig = System.Environment.GetEnvironmentVariable("ACTIVE_DRIVER_CONFIG") ?? TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig); string driverServiceLocation = System.Environment.GetEnvironmentVariable("DRIVER_SERVICE_LOCATION") ?? TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation); diff --git a/dotnet/test/common/Environment/SeleniumTestSerializerContext.cs b/dotnet/test/common/Environment/SeleniumTestSerializerContext.cs deleted file mode 100644 index 906617b74b536..0000000000000 --- a/dotnet/test/common/Environment/SeleniumTestSerializerContext.cs +++ /dev/null @@ -1,27 +0,0 @@ -// -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - - -using System.Text.Json.Serialization; - -namespace OpenQA.Selenium.Environment; - -[JsonSerializable(typeof(TestEnvironment))] -[JsonSourceGenerationOptions(PropertyNameCaseInsensitive = true)] -internal sealed partial class SeleniumTestSerializerContext : JsonSerializerContext;