public IAsyncOperationWithProgress<UInt32, UInt32> WriteAsync(IBuffer buffer)
{
if (buffer == null)
{
// Mapped to E_POINTER.
throw new ArgumentNullException(nameof(buffer));
}
if (buffer.Capacity < buffer.Length)
{
ArgumentException ex = new ArgumentException(SR.Argument_BufferLengthExceedsCapacity);
ex.SetErrorCode(HResults.E_INVALIDARG);
throw ex;
}
// Commented due to a reported CCRewrite bug. Should uncomment when fixed:
//Contract.Ensures(Contract.Result<IAsyncOperationWithProgress<UInt32, UInt32>>() != null);
//Contract.EndContractBlock();
Stream str = EnsureNotDisposed();
return StreamOperationsImplementation.WriteAsync_AbstractStream(str, buffer);
}