Update DumpHeaders to take params span instead of params array#123034
Merged
stephentoub merged 2 commits intomainfrom Jan 9, 2026
Merged
Update DumpHeaders to take params span instead of params array#123034stephentoub merged 2 commits intomainfrom
stephentoub merged 2 commits intomainfrom
Conversation
Co-authored-by: stephentoub <[email protected]>
Copilot
AI
changed the title
[WIP] Update DumpHeaders to take params span instead of array
Update DumpHeaders to take params span instead of params array
Jan 9, 2026
MihaZupan
approved these changes
Jan 9, 2026
Contributor
|
Tagging subscribers to this area: @dotnet/ncl |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the internal DumpHeaders method signature to use C# 12's params ReadOnlySpan<HttpHeaders?> instead of params array, eliminating heap allocation for the params array while maintaining identical semantics.
- Single line signature change from params array to params ReadOnlySpan
- All 3 call sites remain unchanged and compatible with the new signature
- Method implementation already uses only span-compatible operations (Length, indexer)
This was referenced Jan 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Updates the internal
DumpHeadersmethod signature to use C# 12'sparams ReadOnlySpan<T>instead ofparams array, avoiding heap allocation for the params array.Customer Impact
None. Internal method only, no API surface change.
Regression
No.
Testing
Build verified (0 warnings, 0 errors). Method is internal with 3 call sites in
HttpRequestMessage.ToString()andHttpResponseMessage.ToString().Risk
Low. Single line signature change with semantically equivalent behavior.
Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.