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

Fix stack overflow in compiler-generated state #109207

Closed
wants to merge 2 commits into from

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Oct 24, 2024

No description provided.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Oct 24, 2024
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Oct 24, 2024
Copy link
Contributor

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

@@ -122,7 +122,7 @@ public static bool TryGetStateMachineType (MethodDefinition method, [NotNullWhen
return null;

// Avoid repeat scans of the same type
if (_cachedTypeToCompilerGeneratedMembers.ContainsKey (type))
if (!_cachedTypeToCompilerGeneratedMembers.TryAdd (type, null))
return type;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify (might be worth a comment): If we ever get into the recursive call situation, this effectively ignores anything in the compiler generate type (as if it's empty) -> for example suppressions would not work.
I think it's perfectly OK as a behavior, but might be worth a comment to make it clear it was an intentional behavioral choice.

Copy link
Contributor

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@mrvoorhe
Copy link
Contributor

mrvoorhe commented Dec 2, 2024

@sbomer This fixed work. Will you be able to land this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants