Skip to content

Commit

Permalink
fix setting
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyangci committed Dec 31, 2023
1 parent 01a97e0 commit c6ec940
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Microsoft.Bot.Connector.Streaming.Session
{
Expand All @@ -42,6 +43,13 @@ internal class StreamingSession

private readonly object _receiveSync = new object();

static StreamingSession()
{
var tmpSetting = SerializationSettings.DefaultSerializationSettings;
tmpSetting.NullValueHandling = NullValueHandling.Ignore;
Serializer = JsonSerializer.Create(tmpSetting);
}

public StreamingSession(RequestHandler receiver, TransportHandler sender, ILogger logger, CancellationToken connectionCancellationToken = default)
{
_receiver = receiver ?? throw new ArgumentNullException(nameof(receiver));
Expand All @@ -52,7 +60,7 @@ public StreamingSession(RequestHandler receiver, TransportHandler sender, ILogge
_connectionCancellationToken = connectionCancellationToken;
}

private static JsonSerializer Serializer { get; set; } = JsonSerializer.Create(SerializationSettings.DefaultSerializationSettings);
private static JsonSerializer Serializer { get; }

public async Task<ReceiveResponse> SendRequestAsync(StreamingRequest request, CancellationToken cancellationToken)
{
Expand Down

0 comments on commit c6ec940

Please sign in to comment.