@@ -125,13 +125,7 @@ private unsafe int ReadCore(byte[] buffer, int offset, int count)
125
125
[ SecuritySafeCritical ]
126
126
private Task < int > ReadAsyncCore ( byte [ ] buffer , int offset , int count , CancellationToken cancellationToken )
127
127
{
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.
135
129
return base . ReadAsync ( buffer , offset , count , cancellationToken ) ;
136
130
}
137
131
@@ -164,13 +158,7 @@ private unsafe void WriteCore(byte[] buffer, int offset, int count)
164
158
[ SecuritySafeCritical ]
165
159
private Task WriteAsyncCore ( byte [ ] buffer , int offset , int count , CancellationToken cancellationToken )
166
160
{
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.
174
162
return base . WriteAsync ( buffer , offset , count , cancellationToken ) ;
175
163
}
176
164
0 commit comments