Skip to content

Commit af388cf

Browse files
carlossanlopRon Petrusha
authored andcommitted
Manually added docs for System.IO.Pipes.PipeStream (#2751)
* Manually added docs for System.IO.Pipes.PipeStream * Exceptions * suggestions by rpetrusha Co-Authored-By: Ron Petrusha <[email protected]> * suggestion by rpetrusha (Read summary) * Fixed broken xrefs
1 parent 699678c commit af388cf

File tree

1 file changed

+203
-33
lines changed

1 file changed

+203
-33
lines changed

xml/System.IO.Pipes/PipeStream.xml

Lines changed: 203 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,10 +1271,44 @@
12711271
<Parameter Name="buffer" Type="System.Span&lt;System.Byte&gt;" Index="0" FrameworkAlternate="netcore-3.0" />
12721272
</Parameters>
12731273
<Docs>
1274-
<param name="buffer">To be added.</param>
1275-
<summary>To be added.</summary>
1276-
<returns>To be added.</returns>
1277-
<remarks>To be added.</remarks>
1274+
<param name="buffer">A region of memory. When this method returns, the contents of this region are replaced by the bytes read from the current source.</param>
1275+
<summary>Reads a sequence of bytes from the current stream, writes them to a byte array, and advances the position within the stream by the number of bytes read.</summary>
1276+
<returns>The total number of bytes read into the <paramref name="buffer" />. This can be less than the number of bytes allocated in <paramref name="buffer" /> if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.</returns>
1277+
<remarks>
1278+
<format type="text/markdown"><![CDATA[
1279+
1280+
## Remarks
1281+
1282+
Use the <xref:System.IO.Pipes.PipeStream.CanRead%2A> property to determine whether the current <xref:System.IO.Pipes.PipeStream> object supports read operations.
1283+
1284+
Use the <xref:System.IO.Pipes.PipeStream.ReadAsync%2A> method to read asynchronously from the current stream.
1285+
1286+
This method reads a maximum of `buffer.Length` bytes from the current stream and stores them in `buffer`. The current position within the stream is advanced by the number of bytes read; however, if an exception occurs, the current position within the stream remains unchanged.
1287+
1288+
This method will block until at least one byte of data can be read, in the event that no data is available.
1289+
1290+
This method returns 0 only when there is no more data in the stream and no more is expected (such as a closed socket or end of file).
1291+
1292+
This method is free to return fewer bytes than requested even if the end of the stream has not been reached.
1293+
1294+
Use `BinaryReader` for reading primitive data types.
1295+
1296+
]]></format>
1297+
</remarks>
1298+
<exception cref="T:System.ArgumentNullException">The number of bytes read was longer than the buffer length.</exception>
1299+
<exception cref="T:System.NotSupportedException">The stream does not support reading.</exception>
1300+
<exception cref="T:System.ObjectDisposedException">Cannot access a closed pipe.</exception>
1301+
<exception cref="T:System.InvalidOperationException">
1302+
The pipe hasn't been connected yet.
1303+
1304+
- or -
1305+
1306+
The pipe is in a disconnected state.
1307+
1308+
- or -
1309+
1310+
The pipe handle has not been set. (Did your <see cref="T:System.IO.Pipes.PipeStream" /> implementation call <see cref="T:System.IO.Pipes.PipeStream.InitializeHandle(Microsoft.Win32.SafeHandles.SafePipeHandle,System.Boolean,System.Boolean)" />?
1311+
</exception>
12781312
</Docs>
12791313
</Member>
12801314
<Member MemberName="Read">
@@ -1319,7 +1353,7 @@
13191353
<param name="buffer">When this method returns, contains the specified byte array with the values between <paramref name="offset" /> and (<paramref name="offset" /> + <paramref name="count" /> - 1) replaced by the bytes read from the current source.</param>
13201354
<param name="offset">The byte offset in the <paramref name="buffer" /> array at which the bytes that are read will be placed.</param>
13211355
<param name="count">The maximum number of bytes to read.</param>
1322-
<summary>Reads a block of bytes from a stream and writes the data to a specified buffer.</summary>
1356+
<summary>Reads a block of bytes from a stream and writes the data to a specified buffer starting at a specified position for a specified length.</summary>
13231357
<returns>The total number of bytes that are read into <paramref name="buffer" />. This might be less than the number of bytes requested if that number of bytes is not currently available, or 0 if the end of the stream is reached.</returns>
13241358
<remarks>
13251359
<format type="text/markdown"><![CDATA[
@@ -1380,11 +1414,36 @@
13801414
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="1" FrameworkAlternate="netcore-3.0" />
13811415
</Parameters>
13821416
<Docs>
1383-
<param name="buffer">To be added.</param>
1384-
<param name="cancellationToken">To be added.</param>
1385-
<summary>To be added.</summary>
1386-
<returns>To be added.</returns>
1387-
<remarks>To be added.</remarks>
1417+
<param name="buffer">The region of memory to write the data into.</param>
1418+
<param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" />.</param>
1419+
<summary>Asynchronously reads a sequence of bytes from the current stream, writes them to a byte memory range, advances the position within the stream by the number of bytes read, and monitors cancellation requests.</summary>
1420+
<returns>A task that represents the asynchronous read operation. The value of its <see cref="P:System.Threading.Tasks.ValueTask`1.Result" /> property contains the total number of bytes read into the buffer. The result value can be less than the number of bytes allocated in the buffer if that many bytes are not currently available, or it can be 0 (zero) if the end of the stream has been reached.</returns>
1421+
<remarks>
1422+
<format type="text/markdown"><![CDATA[
1423+
1424+
## Remarks
1425+
1426+
The <xref:System.IO.Pipes.PipeStream.ReadAsync%2A> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a [!INCLUDE[win8_appname_long](~/includes/win8-appname-long-md.md)] app or [!INCLUDE[desktop_appname](~/includes/desktop-appname-md.md)] app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the `async` and `await` keywords in Visual Basic and C#.
1427+
1428+
Use the <xref:System.IO.Pipes.PipeStream.CanRead%2A> property to determine whether the current instance supports reading.
1429+
1430+
If the operation is canceled before it completes, the returned task contains the <xref:System.Threading.Tasks.TaskStatus.Canceled?displayProperty=nameWithType> value for the <xref:System.Threading.Tasks.Task.Status> property.
1431+
1432+
]]></format>
1433+
</remarks>
1434+
<exception cref="T:System.NotSupportedException">The stream does not support reading.</exception>
1435+
<exception cref="T:System.ObjectDisposedException">Cannot access a closed pipe.</exception>
1436+
<exception cref="T:System.InvalidOperationException">
1437+
The pipe hasn't been connected yet.
1438+
1439+
- or -
1440+
1441+
The pipe is in a disconnected state.
1442+
1443+
- or -
1444+
1445+
The pipe handle has not been set. (Did your <see cref="T:System.IO.Pipes.PipeStream" /> implementation call <see cref="T:System.IO.Pipes.PipeStream.InitializeHandle(Microsoft.Win32.SafeHandles.SafePipeHandle,System.Boolean,System.Boolean)" />?
1446+
</exception>
13881447
</Docs>
13891448
</Member>
13901449
<Member MemberName="ReadAsync">
@@ -1417,13 +1476,39 @@
14171476
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="3" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netstandard-2.1" />
14181477
</Parameters>
14191478
<Docs>
1420-
<param name="buffer">To be added.</param>
1421-
<param name="offset">To be added.</param>
1422-
<param name="count">To be added.</param>
1423-
<param name="cancellationToken">To be added.</param>
1424-
<summary>To be added.</summary>
1425-
<returns>To be added.</returns>
1426-
<remarks>To be added.</remarks>
1479+
<param name="buffer">The buffer to write the data into.</param>
1480+
<param name="offset">The byte offset in <paramref name="buffer" /> at which to begin writing data from the stream.</param>
1481+
<param name="count">The maximum number of bytes to read.</param>
1482+
<param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" />.</param>
1483+
<summary>Asynchronously reads a sequence of bytes from the current stream to a byte array starting at a specified position for a specified number of bytes, advances the position within the stream by the number of bytes read, and monitors cancellation requests.</summary>
1484+
<returns>A task that represents the asynchronous read operation. The value of its <see cref="P:System.Threading.Tasks.Task`1.Result" /> property contains the total number of bytes read into the buffer. The result value can be less than the number of bytes requested if the number of bytes currently available is less than the requested number, or it can be 0 (zero) if the end of the stream has been reached.</returns>
1485+
<remarks>
1486+
<format type="text/markdown">
1487+
<![CDATA[
1488+
1489+
## Remarks
1490+
1491+
The <xref:System.IO.Pipes.PipeStream.ReadAsync%2A> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a [!INCLUDE[win8_appname_long](~/includes/win8-appname-long-md.md)] app or [!INCLUDE[desktop_appname](~/includes/desktop-appname-md.md)] app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the `async` and `await` keywords in Visual Basic and C#.
1492+
1493+
Use the <xref:System.IO.Pipes.PipeStream.CanRead%2A> property to determine whether the current instance supports reading.
1494+
1495+
If the operation is canceled before it completes, the returned task contains the <xref:System.Threading.Tasks.TaskStatus.Canceled?displayProperty=nameWithType> value for the <xref:System.Threading.Tasks.Task.Status%2A> property.
1496+
1497+
]]></format>
1498+
</remarks>
1499+
<exception cref="T:System.NotSupportedException">The stream does not support reading.</exception>
1500+
<exception cref="T:System.ObjectDisposedException">Cannot access a closed pipe.</exception>
1501+
<exception cref="T:System.InvalidOperationException">
1502+
The pipe hasn't been connected yet.
1503+
1504+
- or -
1505+
1506+
The pipe is in a disconnected state.
1507+
1508+
- or -
1509+
1510+
The pipe handle has not been set. (Did your <see cref="T:System.IO.Pipes.PipeStream" /> implementation call <see cref="T:System.IO.Pipes.PipeStream.InitializeHandle(Microsoft.Win32.SafeHandles.SafePipeHandle,System.Boolean,System.Boolean)" />?
1511+
</exception>
14271512
</Docs>
14281513
</Member>
14291514
<Member MemberName="ReadByte">
@@ -1844,9 +1929,32 @@
18441929
<Parameter Name="buffer" Type="System.ReadOnlySpan&lt;System.Byte&gt;" Index="0" FrameworkAlternate="netcore-3.0" />
18451930
</Parameters>
18461931
<Docs>
1847-
<param name="buffer">To be added.</param>
1848-
<summary>To be added.</summary>
1849-
<remarks>To be added.</remarks>
1932+
<param name="buffer">A region of memory. This method copies the contents of this region to the current stream.</param>
1933+
<summary>Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.</summary>
1934+
<remarks><format type="text/markdown"><![CDATA[
1935+
1936+
## Remarks
1937+
1938+
Use the <xref:System.IO.Pipes.PipeStream.CanWrite%2A> property to determine whether the current instance supports writing. Use the <xref:System.IO.Pipes.PipeStream.WriteAsync%2A> method to write asynchronously to the current stream.
1939+
1940+
If the write operation is successful, the position within the stream advances by the number of bytes written. If an exception occurs, the position within the stream remains unchanged.
1941+
1942+
]]></format>
1943+
</remarks>
1944+
<exception cref="T:System.NotSupportedException">The stream does not support writing.</exception>
1945+
<exception cref="T:System.ObjectDisposedException">Cannot access a closed pipe.</exception>
1946+
<exception cref="T:System.IOException">The pipe is broken.</exception>
1947+
<exception cref="T:System.InvalidOperationException">
1948+
The pipe hasn't been connected yet.
1949+
1950+
- or -
1951+
1952+
The pipe is in a disconnected state.
1953+
1954+
- or -
1955+
1956+
The pipe handle has not been set. (Did your <see cref="T:System.IO.Pipes.PipeStream" /> implementation call <see cref="T:System.IO.Pipes.PipeStream.InitializeHandle(Microsoft.Win32.SafeHandles.SafePipeHandle,System.Boolean,System.Boolean)" />?
1957+
</exception>
18501958
</Docs>
18511959
</Member>
18521960
<Member MemberName="Write">
@@ -1941,11 +2049,37 @@
19412049
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="1" FrameworkAlternate="netcore-3.0" />
19422050
</Parameters>
19432051
<Docs>
1944-
<param name="buffer">To be added.</param>
1945-
<param name="cancellationToken">To be added.</param>
1946-
<summary>To be added.</summary>
1947-
<returns>To be added.</returns>
1948-
<remarks>To be added.</remarks>
2052+
<param name="buffer">The region of memory to write data from.</param>
2053+
<param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" />.</param>
2054+
<summary>Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.</summary>
2055+
<returns>A task that represents the asynchronous write operation.</returns>
2056+
<remarks>
2057+
<format type="text/markdown"><![CDATA[
2058+
2059+
## Remarks
2060+
2061+
The <xref:System.IO.Pipes.PipeStream.WriteAsync%2A> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a [!INCLUDE[win8_appname_long](~/includes/win8-appname-long-md.md)] app or [!INCLUDE[desktop_appname](~/includes/desktop-appname-md.md)] app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the `async` and `await` keywords in Visual Basic and C#.
2062+
2063+
Use the <xref:System.IO.Pipes.PipeStream.CanWrite%2A> property to determine whether the current instance supports writing.
2064+
2065+
If the operation is canceled before it completes, the returned task contains the <xref:System.Threading.Tasks.TaskStatus.Canceled?displayProperty=nameWithtype> value for the <xref:System.Threading.Tasks.Task.Status%2A> property.
2066+
2067+
]]></format>
2068+
</remarks>
2069+
<exception cref="T:System.NotSupportedException">Stream does not support writing.</exception>
2070+
<exception cref="T:System.ObjectDisposedException">Cannot access a closed pipe.</exception>
2071+
<exception cref="T:System.IOException">The pipe is broken.</exception>
2072+
<exception cref="T:System.InvalidOperationException">
2073+
The pipe hasn't been connected yet.
2074+
2075+
- or -
2076+
2077+
The pipe is in a disconnected state.
2078+
2079+
- or -
2080+
2081+
The pipe handle has not been set. (Did your <see cref="T:System.IO.Pipes.PipeStream" /> implementation call <see cref="T:System.IO.Pipes.PipeStream.InitializeHandle(Microsoft.Win32.SafeHandles.SafePipeHandle,System.Boolean,System.Boolean)" />?
2082+
</exception>
19492083
</Docs>
19502084
</Member>
19512085
<Member MemberName="WriteAsync">
@@ -1978,13 +2112,49 @@
19782112
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="3" FrameworkAlternate="netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netstandard-2.1" />
19792113
</Parameters>
19802114
<Docs>
1981-
<param name="buffer">To be added.</param>
1982-
<param name="offset">To be added.</param>
1983-
<param name="count">To be added.</param>
1984-
<param name="cancellationToken">To be added.</param>
1985-
<summary>To be added.</summary>
1986-
<returns>To be added.</returns>
1987-
<remarks>To be added.</remarks>
2115+
<param name="buffer">The buffer to write data from.</param>
2116+
<param name="offset">The zero-based byte offset in <paramref name="buffer" /> from which to begin copying bytes to the stream.</param>
2117+
<param name="count">The maximum number of bytes to write.</param>
2118+
<param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" />.</param>
2119+
<summary>Asynchronously writes a specified number of bytes from a byte array starting at a specified position, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.</summary>
2120+
<returns>A task that represents the asynchronous write operation.</returns>
2121+
<remarks>
2122+
<format type="text/markdown">
2123+
<![CDATA[
2124+
2125+
## Remarks
2126+
2127+
The <xref:System.IO.Pipes.PipeStream.WriteAsync%2A> method enables you to perform resource-intensive I/O operations without blocking the main thread. This performance consideration is particularly important in a [!INCLUDE[win8_appname_long](~/includes/win8-appname-long-md.md)] app or [!INCLUDE[desktop_appname](~/includes/desktop-appname-md.md)] app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. The async methods are used in conjunction with the `async` and `await` keywords in Visual Basic and C#.
2128+
2129+
Use the <xref:System.IO.Pipes.PipeStream.CanWrite%2A> property to determine whether the current instance supports writing.
2130+
2131+
If the operation is canceled before it completes, the returned task contains the <xref:System.Threading.Tasks.TaskStatus.Canceled?displayProperty=nameWithType> value for the <xref:System.Threading.Tasks.Task.Status%2A> property.
2132+
2133+
]]></format>
2134+
</remarks>
2135+
<exception cref="T:System.ArgumentNullException"><paramref name="buffer" /> is <see langword="null" />.</exception>
2136+
<exception cref="T:System.ArgumentOutOfRangeException">
2137+
The <paramref name="offset" /> is negative.
2138+
2139+
- or -
2140+
2141+
The <paramref name="count" /> is negative.
2142+
</exception>
2143+
<exception cref="T:System.ArgumentException"><paramref name="buffer" />.Length - <paramref name="offset" /> is less than <paramref name="count" />.</exception>
2144+
<exception cref="T:System.NotSupportedException">Stream does not support writing.</exception>
2145+
<exception cref="T:System.ObjectDisposedException">Cannot access a closed pipe.</exception>
2146+
<exception cref="T:System.IOException">The pipe is broken.</exception>
2147+
<exception cref="T:System.InvalidOperationException">
2148+
The pipe hasn't been connected yet.
2149+
2150+
- or -
2151+
2152+
The pipe is in a disconnected state.
2153+
2154+
- or -
2155+
2156+
The pipe handle has not been set. (Did your <see cref="T:System.IO.Pipes.PipeStream" /> implementation call <see cref="T:System.IO.Pipes.PipeStream.InitializeHandle(Microsoft.Win32.SafeHandles.SafePipeHandle,System.Boolean,System.Boolean)" />?
2157+
</exception>
19882158
</Docs>
19892159
</Member>
19902160
<Member MemberName="WriteByte">
@@ -2041,4 +2211,4 @@
20412211
</Docs>
20422212
</Member>
20432213
</Members>
2044-
</Type>
2214+
</Type>

0 commit comments

Comments
 (0)