-
Couldn't load subscription status.
- Fork 5.2k
Update MemoryStream max capacity improvements #120091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update MemoryStream max capacity improvements #120091
Conversation
…m.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ontu2912/runtime into fix_update_mode_max_size
Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
…ontu2912/runtime into fix_update_mode_max_size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR follows up on the previous changes to update MemoryStream's maximum capacity improvements by addressing post-merge comments. The primary purpose is to replace hardcoded int.MaxValue references with Array.MaxLength for better consistency and accuracy in memory stream capacity handling.
- Replaced hardcoded
int.MaxValuereferences withArray.MaxLengththroughout MemoryStream implementation - Updated error messages to dynamically reference the actual maximum array length
- Added comprehensive test coverage for capacity boundary checks
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/libraries/System.Private.CoreLib/src/System/IO/MemoryStream.cs | Updated max length constant to use Array.MaxLength, added capacity validation, and improved error messages |
| src/libraries/System.Private.CoreLib/src/Resources/Strings.resx | Updated error message template to accept dynamic maximum length parameter |
| src/libraries/System.Runtime/tests/System.IO.Tests/MemoryStream/MemoryStreamTests.cs | Updated seek overflow tests and added new capacity boundary test |
| src/libraries/System.Runtime/tests/System.IO.Tests/BinaryWriter/BinaryWriterTests.cs | Updated test array to use Array.MaxLength instead of int.MaxValue |
…ontu2912/runtime into fix_update_mode_max_size
|
Current failures don't seem related to these changes |
|
/azp run runtime-libraries-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Follow up PR adressing post-merge comments for #119089