Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON source generator fails with recursive collection type graphs #66421

Closed
layomia opened this issue Mar 9, 2022 · 3 comments · Fixed by #73052
Closed

JSON source generator fails with recursive collection type graphs #66421

layomia opened this issue Mar 9, 2022 · 3 comments · Fixed by #73052
Assignees
Labels
area-System.Text.Json bug source-generator Indicates an issue with a source generator feature
Milestone

Comments

@layomia
Copy link
Contributor

layomia commented Mar 9, 2022

The generator fails to handle types such as the following. Failure mode is a runtime stack overflow. New API is likely needed to correctly handle this (hopefully rare) scenario, given that lazy initialization of element type metadata is required:

public class MyClass : List<MyClass> { }

See [ActiveIssue] additions in #66422 for more (complicated) examples.

@layomia layomia added bug area-System.Text.Json source-generator Indicates an issue with a source generator feature labels Mar 9, 2022
@layomia layomia added this to the 7.0.0 milestone Mar 9, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 9, 2022
@ghost
Copy link

ghost commented Mar 9, 2022

Tagging subscribers to this area: @dotnet/area-system-text-json
See info in area-owners.md if you want to be subscribed.

Issue Details

The generator fails to handle types such as the following. Failure mode is a runtime stack overflow. New API is likely needed to correctly handle this (hopefully rare) scenario, given that lazy initialization of element type metadata is required:

public class MyClass : List<MyClass> { }
Author: layomia
Assignees: -
Labels:

bug, area-System.Text.Json, source-generator

Milestone: 7.0.0

@layomia layomia removed the untriaged New issue has not been triaged by the area owner label Mar 9, 2022
@eiriktsarpalis
Copy link
Member

Failure mode is a runtime stack overflow.

Does this specifically concern fast path serialization? Can you share a repro?

@krwq krwq modified the milestones: 7.0.0, 8.0.0 Jul 6, 2022
@krwq
Copy link
Member

krwq commented Jul 29, 2022

I fixed this accidentally in 897b2a3#diff-b7da6b90947be2bdebc35f367d9dc2c5bb66dd3be881af8a2d6cbb9c18108a7fL528

since that was required for contract customization to work correctly. I'll send PR shortly to re-enable the tests

@krwq krwq modified the milestones: 8.0.0, 7.0.0 Jul 29, 2022
@krwq krwq self-assigned this Jul 29, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 29, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 29, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json bug source-generator Indicates an issue with a source generator feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants