Skip to content

Fix encoding span polyfills for empty spans#570

Merged
SimonCropp merged 1 commit into
SimonCropp:mainfrom
thomhurst:agent/fix-encoding-empty-spans
Jul 15, 2026
Merged

Fix encoding span polyfills for empty spans#570
SimonCropp merged 1 commit into
SimonCropp:mainfrom
thomhurst:agent/fix-encoding-empty-spans

Conversation

@thomhurst

Copy link
Copy Markdown
Contributor

Summary

  • short-circuit stateless Encoding span overloads for empty input
  • use non-null stack storage for empty destinations and stateful Encoder.Convert
  • add empty-source and empty-destination regression coverage
  • regenerate Split sources, assembly-size data, and README snippets

Root cause

Pinning an empty span produces a null pointer. The pointer-based encoding overloads reject null pointers even when the corresponding length is zero, unlike the native span overloads.

Validation

  • dotnet run --project src/ApiBuilderTests/ApiBuilderTests.csproj --configuration Debug — 71 passed
  • dotnet build src/Polyfill.slnx --configuration Release — succeeded, 0 errors
  • pwsh ./src/run-tests.ps1 — full project/framework matrix passed

Closes #569

@SimonCropp SimonCropp added this to the 11.0.1 milestone Jul 15, 2026
@SimonCropp

Copy link
Copy Markdown
Owner

nice. will deploy now

@SimonCropp
SimonCropp merged commit ebf978d into SimonCropp:main Jul 15, 2026
3 of 4 checks passed
This was referenced Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Encoding span polyfills throw on empty spans when unsafe is enabled

2 participants