Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 2281e74

Browse files
committed
Merge pull request #2415 from stephentoub/pipe_asyncasserts_unix
Remove some erroneous / unnecessary asserts in PipeStream on Unix
2 parents 2640351 + 59175ce commit 2281e74

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,7 @@ private unsafe int ReadCore(byte[] buffer, int offset, int count)
125125
[SecuritySafeCritical]
126126
private Task<int> ReadAsyncCore(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
127127
{
128-
Debug.Assert(_handle != null, "_handle is null");
129-
Debug.Assert(!_handle.IsClosed, "_handle is closed");
130-
Debug.Assert(CanRead, "can't read");
131-
Debug.Assert(buffer != null, "buffer is null");
132-
Debug.Assert(offset >= 0, "offset is negative");
133-
Debug.Assert(count >= 0, "count is negative");
134-
128+
// Delegate to the base Stream's ReadAsync, which will just invoke Read asynchronously.
135129
return base.ReadAsync(buffer, offset, count, cancellationToken);
136130
}
137131

@@ -164,13 +158,7 @@ private unsafe void WriteCore(byte[] buffer, int offset, int count)
164158
[SecuritySafeCritical]
165159
private Task WriteAsyncCore(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
166160
{
167-
Debug.Assert(_handle != null, "_handle is null");
168-
Debug.Assert(!_handle.IsClosed, "_handle is closed");
169-
Debug.Assert(CanWrite, "can't write");
170-
Debug.Assert(buffer != null, "buffer is null");
171-
Debug.Assert(offset >= 0, "offset is negative");
172-
Debug.Assert(count >= 0, "count is negative");
173-
161+
// Delegate to the base Stream's WriteAsync, which will just invoke Write asynchronously.
174162
return base.WriteAsync(buffer, offset, count, cancellationToken);
175163
}
176164

0 commit comments

Comments
 (0)