internal async Task DirectWriteAsyncWithSyncContext(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
Contract.Assert(WritePosition == 0);
try
{
#pragma warning disable ConfigureAwaitChecker // CAC001
await Underlying.WriteAsync(buffer, offset, count, cancellationToken);
#pragma warning restore ConfigureAwaitChecker // CAC001
}
catch (Exception e)
{
Connector.Break();
throw new NpgsqlException("Exception while writing to stream", e);
}
}