Skip to content

Commit

Permalink
Fixed regression
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Jan 12, 2024
1 parent 0d6f47f commit 897dd8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ internal sealed class MemberMetadata : Dictionary<string, string>

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<string>(options, JsonMetadataServices.StringConverter);

var info = new JsonCollectionInfoValues<MemberMetadata>
Expand All @@ -35,4 +41,10 @@ internal MemberMetadata()
: base(StringComparer.Ordinal)
{
}

private sealed class SimpleJsonTypeInfoResolver : IJsonTypeInfoResolver
{
JsonTypeInfo? IJsonTypeInfoResolver.GetTypeInfo(Type type, JsonSerializerOptions options)
=> null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static async Task<MemberMetadata> ParseAsync(HttpContent content, CancellationTo
var stream = await content.ReadAsStreamAsync(token).ConfigureAwait(false);
try
{
return await JsonSerializer.DeserializeAsync<MemberMetadata>(stream, MemberMetadata.TypeInfo, token).ConfigureAwait(false) ?? new MemberMetadata();
return await JsonSerializer.DeserializeAsync(stream, MemberMetadata.TypeInfo, token).ConfigureAwait(false) ?? new();
}
finally
{
Expand Down

0 comments on commit 897dd8e

Please sign in to comment.