Repository navigation
Fix MemoryPool<byte>.Shared.MaxBufferSize seems incorrect - #61755
Conversation
`ArrayMemoryPool.MaxBufferSize`'s value was changed to `Array.MaxLength`.
|
Tagging subscribers to this area: @GrabYourPitchforks, @dotnet/area-system-buffers Issue Details
|
|
@bartonjs @ericstj Is there a compat concern here? Scenario: int len = int.MaxValue;
try
{
MemoryPool<byte>.Shared.Rent(len);
}
catch (OutOfMemoryException)
{
/* swallow */
}In .NET 6 and earlier, an OOM would be thrown, and it would be caught and swallowed. With the proposed change here, it's instead an ArgumentOutOfRangeException, so the exception would continue to propagate up the stack. MSDN doesn't exactly specify which exceptions come from I'd appreciate your thoughts on my level of paranoia here. |
|
@teo-tsirpanis if you put "fixes #61560" in the top comment, Github will close it for you when this merges. |
|
@marklio thoughts about the breaking change concern here? It seems to me this exception would never be expected by user code - it would always be a bug in the code - as well as perhaps unlikely case, so this seems reasonable to put in a sxs release. |
|
@michaelgsharp I've assigned this to you to check in on after the new year and to help shepherd this through to merge or closure. |
jeffhandley
left a comment
There was a problem hiding this comment.
I echo @danmoseley's comment about this being an acceptable change to the exception that could be thrown, and I support this change going through.
Thanks for the contribution, @teo-tsirpanis; sorry for the delay getting it merged.
ArrayMemoryPool.MaxBufferSize's value was changed toArray.MaxLength.Fixes #61560