diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/LogEntryConverter.cs b/dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/LogEntryConverter.cs index 17c917d3cd82a..fc72b2024fedc 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/LogEntryConverter.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/LogEntryConverter.cs @@ -34,7 +34,7 @@ internal class LogEntryConverter : JsonConverter { "console" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo()), "javascript" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo()), - _ => null, + _ => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo()), }; } diff --git a/dotnet/src/webdriver/BiDi/Modules/Log/LogEntry.cs b/dotnet/src/webdriver/BiDi/Modules/Log/LogEntry.cs index 5022ed0a5c6b7..e57761a9f2697 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Log/LogEntry.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Log/LogEntry.cs @@ -24,6 +24,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Log; // https://github.com/dotnet/runtime/issues/72604 //[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")] +//[JsonDerivedType(typeof(GenericLogEntry))] // Fallback when discriminator is not recognized, we have to double check //[JsonDerivedType(typeof(ConsoleLogEntry), "console")] //[JsonDerivedType(typeof(JavascriptLogEntry), "javascript")] public abstract record LogEntry(BiDi BiDi, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp) @@ -32,6 +33,9 @@ public abstract record LogEntry(BiDi BiDi, Level Level, Script.Source Source, st public Script.StackTrace? StackTrace { get; set; } } +public record GenericLogEntry(BiDi BiDi, string Type, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp) + : LogEntry(BiDi, Level, Source, Text, Timestamp); + public record ConsoleLogEntry(BiDi BiDi, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp, string Method, IReadOnlyList Args) : LogEntry(BiDi, Level, Source, Text, Timestamp);