@@ -40,8 +40,6 @@ public static class SeleniumManager
4040 {
4141 private static readonly ILogger _logger = Log . GetLogger ( typeof ( SeleniumManager ) ) ;
4242
43- private static readonly JsonSerializerOptions _serializerOptions = new ( ) { PropertyNameCaseInsensitive = true , TypeInfoResolver = SeleniumManagerSerializerContext . Default } ;
44-
4543 private static readonly Lazy < string > _lazyBinaryFullPath = new ( ( ) =>
4644 {
4745 string ? binaryFullPath = Environment . GetEnvironmentVariable ( "SE_MANAGER_PATH" ) ;
@@ -187,7 +185,7 @@ private static ResultResponse RunCommand(string fileName, string arguments)
187185
188186 try
189187 {
190- jsonResponse = JsonSerializer . Deserialize < SeleniumManagerResponse > ( output , _serializerOptions ) ! ;
188+ jsonResponse = JsonSerializer . Deserialize ( output , SeleniumManagerSerializerContext . Default . SeleniumManagerResponse ) ! ;
191189 }
192190 catch ( Exception ex )
193191 {
@@ -210,11 +208,11 @@ private static ResultResponse RunCommand(string fileName, string arguments)
210208 }
211209 }
212210
213- internal record SeleniumManagerResponse ( IReadOnlyList < LogEntryResponse > Logs , ResultResponse Result )
211+ internal sealed record SeleniumManagerResponse ( IReadOnlyList < LogEntryResponse > Logs , ResultResponse Result )
214212 {
215- public record LogEntryResponse ( string Level , string Message ) ;
213+ public sealed record LogEntryResponse ( string Level , string Message ) ;
216214
217- public record ResultResponse
215+ public sealed record ResultResponse
218216 (
219217 [ property: JsonPropertyName ( "driver_path" ) ]
220218 string DriverPath ,
@@ -224,5 +222,6 @@ string BrowserPath
224222 }
225223
226224 [ JsonSerializable ( typeof ( SeleniumManagerResponse ) ) ]
227- internal partial class SeleniumManagerSerializerContext : JsonSerializerContext ;
225+ [ JsonSourceGenerationOptions ( PropertyNameCaseInsensitive = true ) ]
226+ internal sealed partial class SeleniumManagerSerializerContext : JsonSerializerContext ;
228227}
0 commit comments