Skip to content

Conversation

@stephentoub
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings July 4, 2025 01:48
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a 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 inlines the AllocateBuffer helper from a private method into a local function within EnsureBufferAllocated, removes a stale TODO, and updates the buffer allocation call.

  • Inlined AllocateBuffer into EnsureBufferAllocated as a local function
  • Removed the TODO about converting to a local function
  • Updated Interlocked.CompareExchange usage inside the new local function
Comments suppressed due to low confidence (2)

src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs:1030

  • The MemberNotNull attribute on the local function does not inform the null-state of the outer method. To ensure the compiler recognizes that _buffer is non-null after calling EnsureBufferAllocated, move this attribute to the EnsureBufferAllocated method signature instead.
                [MemberNotNull(nameof(_buffer))]

src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs:1031

  • Local functions do not support inlining attributes in the same way as top-level methods; this annotation may be ignored or cause a compile error. Consider removing it or moving it to the outer EnsureBufferAllocated method if no-inlining is required.
                [MethodImpl(MethodImplOptions.NoInlining)]

@stephentoub
Copy link
Member Author

/ba-g unrelated test failures

@stephentoub stephentoub merged commit eef526e into dotnet:main Jul 7, 2025
133 of 144 checks passed
@stephentoub stephentoub deleted the bufferedtodo branch July 7, 2025 01:55
@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants