C#: do not drop resource handles in finalizers#1040
Merged
alexcrichton merged 2 commits intobytecodealliance:mainfrom Aug 29, 2024
Merged
C#: do not drop resource handles in finalizers#1040alexcrichton merged 2 commits intobytecodealliance:mainfrom
alexcrichton merged 2 commits intobytecodealliance:mainfrom
Conversation
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 <joel.dice@fermyon.com>
dicej
added a commit
to dicej/runtimelab
that referenced
this pull request
Aug 29, 2024
See bytecodealliance/wit-bindgen#1040 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
dicej
added a commit
to dicej/spin-dotnet-sdk
that referenced
this pull request
Aug 29, 2024
See bytecodealliance/wit-bindgen#1040 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
pavelsavara
reviewed
Aug 29, 2024
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
pavelsavara
approved these changes
Aug 29, 2024
alexcrichton
approved these changes
Aug 29, 2024
francomattar
added a commit
to francomattar/spin-sdk-dotnet
that referenced
this pull request
Dec 13, 2024
See bytecodealliance/wit-bindgen#1040 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
artemsuvorov3
added a commit
to artemsuvorov3/artem-spin-dotnet-sdk
that referenced
this pull request
Jan 8, 2025
See bytecodealliance/wit-bindgen#1040 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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