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

Tracking issue for stack overflow exception in devenv and OOP #63349

Open
1 of 3 tasks
Cosifne opened this issue Aug 12, 2022 · 6 comments
Open
1 of 3 tasks

Tracking issue for stack overflow exception in devenv and OOP #63349

Cosifne opened this issue Aug 12, 2022 · 6 comments
Assignees
Milestone

Comments

@Cosifne
Copy link
Member

Cosifne commented Aug 12, 2022

Using sample code:
LongClass.txt

Many places using recursion would fail in this case.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 12, 2022
@genlu
Copy link
Member

genlu commented Aug 12, 2022

We probably need to make sure we use the same pattern to guard against this kind of issues in IDE visitors/walkers

@genlu genlu added Bug Area-IDE and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 12, 2022
@genlu genlu modified the milestones: 17.4, 17.4 P2 Aug 12, 2022
@genlu
Copy link
Member

genlu commented Aug 12, 2022

And we need to add an integration test with the sample code here.

@CyrusNajmabadi
Copy link
Member

Generally speaking, we've found that there is always a limit to pathological cases and some part of the system will always fall over. So, we try to ensure we don't regress on existing code that works, but we don't use pathologically generated code (like what looks like that test file) as it's a never ending chase.

@Cosifne
Copy link
Member Author

Cosifne commented Aug 12, 2022

Generally speaking, we've found that there is always a limit to pathological cases and some part of the system will always fall over. So, we try to ensure we don't regress on existing code that works, but we don't use pathologically generated code (like what looks like that test file) as it's a never ending chase.

I feel if the recursion is easy enough to rewrite, we should do this like https://sourceroslyn.io/#Microsoft.CodeAnalysis.Features/Wrapping/BinaryExpression/AbstractBinaryExpressionWrapper.cs,f461f8abcebe1530,references

Other things like SyntaxWalker or SyntaxVisitor, yes it can't works for everything, but the question is, should caller of it try to handle the error (like the link @genlu posted, return an empty array) more gracefully?

@genlu
Copy link
Member

genlu commented Aug 12, 2022

@CyrusNajmabadi you are right. But I think @Cosifne's approach makes sense. For IDE features based on compiler visitors/walkers, we need to at least ensure they don't crash on deep recursions (probably by using EnsureSufficientExecutionStack pattern). But for simple recursions (like the one being fixed in #63338) it might be better to simply convert it to iteration.

@Cosifne Cosifne modified the milestones: 17.4 P2, 17.4 Sep 26, 2022
@Cosifne Cosifne self-assigned this Sep 26, 2022
@arkalyanms arkalyanms modified the milestones: 17.4, 17.6 P3 Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants