Skip to content

Commit 5a43ad4

Browse files
committed
Add reflection-based JSON fallback
1 parent b46629e commit 5a43ad4

File tree

1 file changed

+8
-0
lines changed
  • dotnet/src/webdriver/BiDi/Communication

1 file changed

+8
-0
lines changed

dotnet/src/webdriver/BiDi/Communication/Broker.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
using System;
2525
using System.Collections.Concurrent;
2626
using System.Collections.Generic;
27+
using System.Diagnostics.CodeAnalysis;
2728
using System.Linq;
2829
using System.Text.Json;
2930
using System.Text.Json.Serialization;
@@ -110,6 +111,13 @@ internal Broker(BiDi bidi, ITransport transport)
110111
_jsonSerializerContext = jsonSerializerOptions;
111112
}
112113

114+
[RequiresUnreferencedCode("Uses reflection-based JSON serialization")]
115+
[RequiresDynamicCode("Uses reflection-based JSON serialization")]
116+
public void EnableReflectionBasedJson()
117+
{
118+
_jsonSerializerContext.TypeInfoResolverChain.Add(new DefaultJsonTypeInfoResolver());
119+
}
120+
113121
public void ProvideCustomSerializationContext(JsonSerializerContext extensionContext)
114122
{
115123
_jsonSerializerContext.TypeInfoResolverChain.Add(extensionContext);

0 commit comments

Comments
 (0)