.NET: Make serialize methods sync and rename one to match others. (#946)

* Make serialize methods sync and rename one to match others.

* Remove unnecessary async postfixes.

* Remove nullability of ChatMessageStore.Serialize return type, since the default JsonElement already represents an undefined json element.

* Fix unit test
This commit is contained in:
westey
2025-09-29 09:32:01 +00:00
committed by GitHub
parent 7c5b553c7e
commit bf5931932e
21 changed files with 64 additions and 86 deletions
@@ -121,14 +121,14 @@ public sealed class InMemoryChatMessageStore : ChatMessageStore, IList<ChatMessa
}
/// <inheritdoc />
public override ValueTask<JsonElement?> SerializeStateAsync(JsonSerializerOptions? jsonSerializerOptions = null, CancellationToken cancellationToken = default)
public override JsonElement Serialize(JsonSerializerOptions? jsonSerializerOptions = null)
{
StoreState state = new()
{
Messages = this._messages,
};
return new ValueTask<JsonElement?>(JsonSerializer.SerializeToElement(state, AgentAbstractionsJsonUtilities.DefaultOptions.GetTypeInfo(typeof(StoreState))));
return JsonSerializer.SerializeToElement(state, AgentAbstractionsJsonUtilities.DefaultOptions.GetTypeInfo(typeof(StoreState)));
}
/// <inheritdoc />