Skip to content

Honour DoNotRelease on SafeHandles - #654

Merged
Andrew Arnott (AArnott) merged 1 commit into
microsoft:mainfrom
elachlan:DoNotReleaseAttribute-SafeHandles
Aug 19, 2022
Merged

Andrew Arnott (AArnott) merged 1 commit into
microsoft:mainfrom
elachlan:DoNotReleaseAttribute-SafeHandles

Conversation

@elachlan

@elachlan Lachlan Ennis (elachlan) commented Aug 16, 2022 •

Copy link
Copy Markdown
Contributor

Fixes #644 and possibly #91?

@elachlan

Lachlan Ennis (elachlan) commented Aug 17, 2022 •

Copy link
Copy Markdown
Contributor Author

CC: Loni Tra (@lonitra) I guess this isn't useful to you since safehandle overloads are disabled in winforms now.

@elachlan

Copy link
Copy Markdown
Contributor Author

CC: Andrew Arnott (@AArnott)

@AArnott Andrew Arnott (AArnott) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perfect. I wish there was a good way to test this, but I gave it a quick try and unfortunately there is no public API on SafeHandle that exposes the second argument passed to its constructor. And a syntax-level test would be very brittle.

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.

GetModuleHandle shouldn't return FreeLibrarySafeHandle GetStdHandle shouldn't return a CloseHandleSafeHandle

2 participants