-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed as not planned
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Runtime.InteropServices
Description
Background and motivation
From #124375 (comment):
addedRefis always true on return from DangerousAddRef (the argument is left over from thread abort hardeing that we do not care about anymore)
Because of this, the usage often looks like this:
runtime/src/libraries/Common/src/Interop/Windows/Advapi32/SafeHashHandle.cs
Lines 34 to 35 in 8b63bd2
| bool ignored = false; | |
| _parent.DangerousAddRef(ref ignored); |
runtime/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.SafeWinHttpHandle.cs
Lines 39 to 40 in 8b63bd2
| bool ignore = false; | |
| parentHandle.DangerousAddRef(ref ignore); |
API Proposal
namespace System.Runtime.InteropServices;
public abstract partial class SafeHandle
{
+ [EditorBrowsable(EditorBrowsableState.Never)]
public void DangerousAddRef(ref bool success);
+ public void DangerousAddRef();
}API Usage
handle.DangerousAddRef();Risks
DangerousAddRef(ref bool success) is not abstract or virtual, so I can't see any.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Runtime.InteropServices
Type
Projects
Status
No status