|
25 | 25 | using System.Net.Http; |
26 | 26 | using System.Text.Json; |
27 | 27 | using System.Text.Json.Nodes; |
| 28 | +using System.Text.Json.Serialization; |
28 | 29 | using System.Threading; |
29 | 30 | using System.Threading.Tasks; |
30 | 31 |
|
@@ -284,7 +285,7 @@ public T GetVersionSpecificDomains<T>() where T : DevToolsSessionDomains |
284 | 285 |
|
285 | 286 | LogTrace("Sending {0} {1}: {2}", message.CommandId, message.CommandName, commandParameters.ToString()); |
286 | 287 |
|
287 | | - string contents = JsonSerializer.Serialize(message, DevToolsSerializerContext.Default.DevToolsCommandData); |
| 288 | + string contents = JsonSerializer.Serialize(message, DevToolsSessionSerializerContext.Default.DevToolsCommandData); |
288 | 289 | this.pendingCommands.TryAdd(message.CommandId, message); |
289 | 290 | await this.connection.SendData(contents).ConfigureAwait(false); |
290 | 291 |
|
@@ -411,7 +412,7 @@ private async Task<int> InitializeProtocol(int requestedProtocolVersion) |
411 | 412 | rawVersionInfo = await client.GetStringAsync("/json/version").ConfigureAwait(false); |
412 | 413 | } |
413 | 414 |
|
414 | | - var versionInfo = JsonSerializer.Deserialize(rawVersionInfo, DevToolsSerializerContext.Default.DevToolsVersionInfo); |
| 415 | + var versionInfo = JsonSerializer.Deserialize(rawVersionInfo, DevToolsSessionSerializerContext.Default.DevToolsVersionInfo); |
415 | 416 | this.websocketAddress = versionInfo.WebSocketDebuggerUrl; |
416 | 417 |
|
417 | 418 | if (requestedProtocolVersion == AutoDetectDevToolsProtocolVersion) |
@@ -664,4 +665,8 @@ private void LogError(string message, params object[] args) |
664 | 665 | } |
665 | 666 | } |
666 | 667 | } |
| 668 | + |
| 669 | + [JsonSerializable(typeof(DevToolsCommandData))] |
| 670 | + [JsonSerializable(typeof(DevToolsVersionInfo))] |
| 671 | + internal sealed partial class DevToolsSessionSerializerContext : JsonSerializerContext; |
667 | 672 | } |
0 commit comments