From ec4f8f83229da611e8e0a4a3e6e87763285d8001 Mon Sep 17 00:00:00 2001 From: Nasif Ishtiaque Islam Date: Sat, 4 Oct 2025 05:52:12 +0600 Subject: [PATCH] Align MemoryStream Position and Seek docs with SetLength Updated ArgumentOutOfRangeException documentation for Position property and Seek method to include the more precise explanation about the maximum length calculation that accounts for the origin parameter. Both now match the detailed description in SetLength, specifying that the maximum length is (Int32.MaxValue - origin), where origin is the index into the underlying buffer at which the stream starts. Fixes #9201 --- xml/System.IO/MemoryStream.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xml/System.IO/MemoryStream.xml b/xml/System.IO/MemoryStream.xml index 1fa8f5acad6..1364fbfdd61 100644 --- a/xml/System.IO/MemoryStream.xml +++ b/xml/System.IO/MemoryStream.xml @@ -1800,7 +1800,7 @@ The pending operation does not support writing. ]]> - The position is set to a negative value or a value greater than Int32.MaxValue. + The position is set to a negative value or a value greater than the maximum length of the , where the maximum length is (Int32.MaxValue - origin), and origin is the index into the underlying buffer at which the stream starts. The stream is closed. File and Stream I/O How to: Read Text from a File @@ -2244,7 +2244,7 @@ The pending operation does not support writing. Seeking is attempted before the beginning of the stream. - is greater than Int32.MaxValue. + is greater than the maximum length of the , where the maximum length is (Int32.MaxValue - origin), and origin is the index into the underlying buffer at which the stream starts. There is an invalid . -or-