Skip to content

Commit 3d0f690

Browse files
authored
[dotnet] [bidi] Added missing GenericLogEntry log entry type in Script module (#15591)
1 parent 9935e51 commit 3d0f690

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/LogEntryConverter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal class LogEntryConverter : JsonConverter<Modules.Log.LogEntry>
3434
{
3535
"console" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<ConsoleLogEntry>()),
3636
"javascript" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<JavascriptLogEntry>()),
37-
_ => null,
37+
_ => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<GenericLogEntry>()),
3838
};
3939
}
4040

dotnet/src/webdriver/BiDi/Modules/Log/LogEntry.cs

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Log;
2424

2525
// https://github.com/dotnet/runtime/issues/72604
2626
//[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
27+
//[JsonDerivedType(typeof(GenericLogEntry))] // Fallback when discriminator is not recognized, we have to double check
2728
//[JsonDerivedType(typeof(ConsoleLogEntry), "console")]
2829
//[JsonDerivedType(typeof(JavascriptLogEntry), "javascript")]
2930
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
3233
public Script.StackTrace? StackTrace { get; set; }
3334
}
3435

36+
public record GenericLogEntry(BiDi BiDi, string Type, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp)
37+
: LogEntry(BiDi, Level, Source, Text, Timestamp);
38+
3539
public record ConsoleLogEntry(BiDi BiDi, Level Level, Script.Source Source, string Text, DateTimeOffset Timestamp, string Method, IReadOnlyList<Script.RemoteValue> Args)
3640
: LogEntry(BiDi, Level, Source, Text, Timestamp);
3741

0 commit comments

Comments
 (0)