Description
internal ChatClientAgentSession(string? conversationId, AgentSessionStateBag? stateBag) : base(stateBag ?? new())
I have this setting for my solution. It's a more strict setting for deserialization.
<RuntimeHostConfigurationOption
Include="System.Text.Json.Serialization.RespectRequiredConstructorParametersDefault"
Value="true" />
The default option uses JsonIgnoreCondition.WhenWritingNull, and when the json is deserialized, the required parameters will not be provided.
There can be multiple solutions:
- Do not use that settings, but I want to keep it.
internal ChatClientAgentSession(string? conversationId, AgentSessionStateBag? stateBag) => internal ChatClientAgentSession(string? conversationId = null, AgentSessionStateBag? stateBag = null). Provide default values for constructor.
- Makes the constructor
public, so a custom serialization options can be provided. We seems to need a public constructor for custom serialization. Then I can override that JsonIgnoreCondition.WhenWritingNull.
Code Sample
Language/SDK
.NET
Description
I have this setting for my solution. It's a more strict setting for deserialization.
The default option uses
JsonIgnoreCondition.WhenWritingNull, and when the json is deserialized, the required parameters will not be provided.There can be multiple solutions:
internal ChatClientAgentSession(string? conversationId, AgentSessionStateBag? stateBag) => internal ChatClientAgentSession(string? conversationId = null, AgentSessionStateBag? stateBag = null). Provide default values for constructor.public, so a custom serialization options can be provided. We seems to need a public constructor for custom serialization. Then I can override thatJsonIgnoreCondition.WhenWritingNull.Code Sample
Language/SDK
.NET