Skip to content

Align MemoryStream Position and Seek to mention origin on ArgumentOutOfRangeException #9201

Open

Description

@jozkee

MemoryStream was recently fixed to avoid falling into a state where it could contain a negative Position dotnet/runtime#88572.

Some API docs don't mention the origin when they talk about ArgumentOutOfRangeException and only mention that the value must be between int.MaxValue and zero.

SetLength does correctly reflect that the limit accounts for the origin:

value is negative or is greater than the maximum length of the MemoryStream, where the maximum length is (Int32.MaxValue - origin), and origin is the index into the underlying buffer at which the stream starts.

We need to amend the former cases to align with SetLength's.

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Aug 21, 2023
  2. ghost added
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Aug 21, 2023
  3. added
    help wantedGood for community contributors to help [up-for-grabs]
    and removed
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Aug 21, 2023
  4. added this to the Backlog milestone on Aug 21, 2023
  5. ghost removed
    untriagedNew issue has not been triaged by the area owner
    on Aug 21, 2023
  6. added a commit that references this issue on Oct 3, 2025
    ec4f8f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3Indicates issues/PRs that are low priorityarea-System.IOhelp wantedGood for community contributors to help [up-for-grabs]

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions