Provide an additional friendly overload with raw unconvertible handles when necessary#1693
Open
DoctorKrolic wants to merge 1 commit into
Open
Provide an additional friendly overload with raw unconvertible handles when necessary#1693DoctorKrolic wants to merge 1 commit into
DoctorKrolic wants to merge 1 commit into
Conversation
Member
|
There is already a safeHandles knob in NativeMethods.json. How is this different than letting the consumer choose a different form of the projection? More overloads can just be more confusing. It sounds like from the description this is limited to "complex" handles, could you give some concrete examples for those and how this would help? |
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.
Previously if friendly overload accepted a handle with a known release method CsWin32 would always "promote" it to a
SafeHandle. This works well if CsWin32 can trivially represent that handle as aSafeHandleso that function that opens/creates the handle in the first place returns it a a custom generatedSafeHandle. However, if release method is a complicated one and CsWin32 cannot generate a trivialSafeHandlewrapper based on it user was forced to declare such safe handle type on their own to use it in other friendly overloads. This might not be ideal e.g. if the handle is used whithin one method frame so that declaring a safe handle type for it is an overkill. Now CsWin32 generates another overload with such handles represented as "raw" handles so that user has a choice either to use the raw handle or to declare their own safe handle type and use it instead