Skip to content

Commit

Permalink
fix: temporarily remove converter, even if it's not the same instance (
Browse files Browse the repository at this point in the history
…#642)

avoids stackoverflow exceptions

Co-authored-by: Konstantin <[email protected]>
  • Loading branch information
hf-kklein and Konstantin authored Jan 15, 2025
1 parent a183f5f commit ea3a4b5
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@ JsonSerializerOptions options
// avoid stack overflow/infinity recursion
optionsWithoutThisConverter.Converters.Remove(this);
}

if (
optionsWithoutThisConverter.Converters.FirstOrDefault(c =>
c.GetType()
== typeof(LenientSystemTextJsonEnumListConverter)
) is
{ } sameTypeConverter
)
{
optionsWithoutThisConverter.Converters.Remove(
sameTypeConverter
);
}
var helperJsonList = "[" + element.GetRawText() + "]";
var subResultList = System.Text.Json.JsonSerializer.Deserialize(
helperJsonList,
Expand Down

0 comments on commit ea3a4b5

Please sign in to comment.