diff --git a/src/cluster/DotNext.AspNetCore.Cluster/Net/Cluster/Consensus/Raft/Http/MemberMetadata.cs b/src/cluster/DotNext.AspNetCore.Cluster/Net/Cluster/Consensus/Raft/Http/MemberMetadata.cs index 53595328d..c98aa6dbf 100644 --- a/src/cluster/DotNext.AspNetCore.Cluster/Net/Cluster/Consensus/Raft/Http/MemberMetadata.cs +++ b/src/cluster/DotNext.AspNetCore.Cluster/Net/Cluster/Consensus/Raft/Http/MemberMetadata.cs @@ -9,7 +9,13 @@ internal sealed class MemberMetadata : Dictionary static MemberMetadata() { - var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = false, WriteIndented = false }; + var options = new JsonSerializerOptions + { + PropertyNameCaseInsensitive = false, + WriteIndented = false, + TypeInfoResolver = new SimpleJsonTypeInfoResolver(), + }; + var stringTypeInfo = JsonMetadataServices.CreateValueInfo(options, JsonMetadataServices.StringConverter); var info = new JsonCollectionInfoValues @@ -35,4 +41,10 @@ internal MemberMetadata() : base(StringComparer.Ordinal) { } + + private sealed class SimpleJsonTypeInfoResolver : IJsonTypeInfoResolver + { + JsonTypeInfo? IJsonTypeInfoResolver.GetTypeInfo(Type type, JsonSerializerOptions options) + => null; + } } \ No newline at end of file diff --git a/src/cluster/DotNext.AspNetCore.Cluster/Net/Cluster/Consensus/Raft/Http/MetadataMessage.cs b/src/cluster/DotNext.AspNetCore.Cluster/Net/Cluster/Consensus/Raft/Http/MetadataMessage.cs index f2daa8379..b1500a368 100644 --- a/src/cluster/DotNext.AspNetCore.Cluster/Net/Cluster/Consensus/Raft/Http/MetadataMessage.cs +++ b/src/cluster/DotNext.AspNetCore.Cluster/Net/Cluster/Consensus/Raft/Http/MetadataMessage.cs @@ -26,7 +26,7 @@ static async Task ParseAsync(HttpContent content, CancellationTo var stream = await content.ReadAsStreamAsync(token).ConfigureAwait(false); try { - return await JsonSerializer.DeserializeAsync(stream, MemberMetadata.TypeInfo, token).ConfigureAwait(false) ?? new MemberMetadata(); + return await JsonSerializer.DeserializeAsync(stream, MemberMetadata.TypeInfo, token).ConfigureAwait(false) ?? new(); } finally {