Skip to content

Commit

Permalink
Tweak JsonSerializerOptions resolution logic in wrapper implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriktsarpalis committed Jan 9, 2023
1 parent 8a8b148 commit 81986b9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private JsonSerializerOptions GetOptions(JsonSerializerOptions? options = null)
return _defaultContext.Options;
}

if (options.TypeInfoResolver is null || options.TypeInfoResolver == JsonSerializerOptions.Default.TypeInfoResolver)
if (options.TypeInfoResolver is null or DefaultJsonTypeInfoResolver { Modifiers.Count: 0 })
{
return new JsonSerializerOptions(options) { TypeInfoResolver = _defaultContext };
}
Expand Down Expand Up @@ -125,7 +125,7 @@ private JsonSerializerOptions GetOptions(JsonSerializerOptions? options = null)
return _defaultContext.Options;
}

if (options.TypeInfoResolver is null || options.TypeInfoResolver == JsonSerializerOptions.Default.TypeInfoResolver)
if (options.TypeInfoResolver is null or DefaultJsonTypeInfoResolver { Modifiers.Count: 0 })
{
return new JsonSerializerOptions(options) { TypeInfoResolver = _defaultContext };
}
Expand Down

0 comments on commit 81986b9

Please sign in to comment.