Skip to content

Improve reliability of some SafeHandle creations - #72341

Merged
stephentoub merged 2 commits into
dotnet:mainfrom
stephentoub:safehandlereliability
Jul 18, 2022
Merged

stephentoub merged 2 commits into
dotnet:mainfrom
stephentoub:safehandlereliability

Conversation

@stephentoub

Copy link
Copy Markdown
Member

Use the new Marshal.InitHandle to support creating the SafeHandle instance before the native call and then storing the handle after, as is done implicitly as part of interop calls that return SafeHandles. Also replace some existing such SetHandle methods with Marshal.InitHandle.

Use the new Marshal.InitHandle to support creating the SafeHandle instance before the native call and then storing the handle after, as is done implicitly as part of interop calls that return SafeHandles.  Also replace some existing such SetHandle methods with Marshal.InitHandle.
@ghost

ghost commented Jul 17, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

Use the new Marshal.InitHandle to support creating the SafeHandle instance before the native call and then storing the handle after, as is done implicitly as part of interop calls that return SafeHandles. Also replace some existing such SetHandle methods with Marshal.InitHandle.

Author: stephentoub
Assignees: -
Labels:

area-System.Security

Milestone: -

Add InteropServices namespace
@stephentoub
stephentoub merged commit aafa910 into dotnet:main Jul 18, 2022
@stephentoub
stephentoub deleted the safehandlereliability branch July 18, 2022 02:17
@ghost ghost locked as resolved and limited conversation to collaborators Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants