{
if (pHandle == null)
{
- throw new ArgumentNullException(nameof(pHandle), Environment.GetResourceString("ArgumentNull_SafeHandle"));
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.pHandle, ExceptionResource.ArgumentNull_SafeHandle);
}
- Contract.EndContractBlock();
pHandle.DangerousAddRef(ref success);
-
- return (success ? pHandle.DangerousGetHandle() : IntPtr.Zero);
+ return pHandle.DangerousGetHandle();
}
// Releases the SH (to be called from finally block).
{
if (pHandle == null)
{
- throw new ArgumentNullException(nameof(pHandle), Environment.GetResourceString("ArgumentNull_SafeHandle"));
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.pHandle, ExceptionResource.ArgumentNull_SafeHandle);
}
- Contract.EndContractBlock();
try
{
throw new ArgumentNullException(GetResourceString(resource));
}
+ internal static void ThrowArgumentNullException(ExceptionArgument argument, ExceptionResource resource)
+ {
+ throw new ArgumentNullException(GetArgumentName(argument), GetResourceString(resource));
+ }
+
internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument) {
throw new ArgumentOutOfRangeException(GetArgumentName(argument));
}
callBack,
type,
stateMachine,
+ pHandle,
}
//
ArgumentOutOfRange_Enum,
InvalidOperation_HandleIsNotInitialized,
AsyncMethodBuilder_InstanceNotInitialized,
+ ArgumentNull_SafeHandle,
}
}