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

C#: do not drop resource handles in finalizers #1040

Merged

Conversation

dicej
Copy link
Collaborator

@dicej dicej commented Aug 29, 2024

As of this writing, we cannot safely drop a handle to an imported resource from a .NET finalizer because it may still have one or more open child resources. Once WIT has explicit syntax for indicating parent/child relationships, we should be able to use that information to keep track of child resources automatically in generated code, at which point we'll be able to drop them in the correct order from finalizers.

Fixes #1039

As of this writing, we cannot safely drop a handle to an imported resource from
a .NET finalizer because it may still have one or more open child resources.
Once WIT has explicit syntax for indicating parent/child relationships, we
should be able to use that information to keep track of child resources
automatically in generated code, at which point we'll be able to drop them in
the correct order from finalizers.

Fixes bytecodealliance#1039

Signed-off-by: Joel Dice <[email protected]>
dicej added a commit to dicej/runtimelab that referenced this pull request Aug 29, 2024
dicej added a commit to dicej/spin-dotnet-sdk that referenced this pull request Aug 29, 2024
@alexcrichton alexcrichton added this pull request to the merge queue Aug 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 29, 2024
@alexcrichton alexcrichton added this pull request to the merge queue Aug 29, 2024
Merged via the queue into bytecodealliance:main with commit c648fc7 Aug 29, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C#: the generated finalization logic does not take child resources into account
3 participants