Skip to content

fix(csharp): allocate requested stack buffer size#54730

Merged
BillWagner merged 1 commit into
dotnet:mainfrom
kushin25:kushin25/fix-stackalloc-example-allocation
Jul 10, 2026
Merged

fix(csharp): allocate requested stack buffer size#54730
BillWagner merged 1 commit into
dotnet:mainfrom
kushin25:kushin25/fix-stackalloc-example-allocation

Conversation

@kushin25

@kushin25 kushin25 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Corrects the LimitStackalloc snippet so its stack allocation uses the requested inputLength rather than always allocating MaxStackLimit.

Changes

  • Use stackalloc byte[inputLength] when inputLength is within the stack limit.

Related issue

Fixes #54665

Validation

  • git diff --cached --check
  • Targeted source assertion confirming the corrected conditional allocation

Notes

  • The local .NET SDK is not installed, so a project build was not run.

@kushin25 kushin25 requested review from a team and BillWagner as code owners July 9, 2026 20:51
@dotnetrepoman dotnetrepoman Bot added this to the July 2026 milestone Jul 9, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates PR is created by someone from the .NET community. label Jul 9, 2026

@BillWagner BillWagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM.

@BillWagner BillWagner merged commit 63973d5 into dotnet:main Jul 10, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example issue in stackalloc docs page

2 participants