Skip to content

Fix string.Join(char, ReadOnlySpan) stack overflow - #618

Merged
SimonCropp merged 2 commits into
mainfrom
fix/string-join-span-recursion
Oct 12, 2026
Merged

SimonCropp merged 2 commits into
mainfrom
fix/string-join-span-recursion

Conversation

@SimonCropp

Copy link
Copy Markdown
Owner

string.Join(char, ReadOnlySpan<object?>) (and the ReadOnlySpan<string?> overload when AllowUnsafeBlocks is off) called the unqualified Join. On TFMs with no polyfilled array overload (netcoreapp, netstandard2.1, net5-net8) that bound back to the same span overload and killed the process with a stack overflow.

The calls are now qualified as string.Join so they reach the array overloads. Adds a test that passes explicit spans.

@SimonCropp SimonCropp added this to the 11.4.4 milestone Oct 11, 2026
The span overloads called the unqualified Join, which on TFMs without a polyfilled array overload bound back to the same span overload and overflowed the stack. Qualify the calls as string.Join so they reach the array overloads.
@SimonCropp
SimonCropp force-pushed the fix/string-join-span-recursion branch from 8d51bd9 to d44fac2 Compare October 12, 2026 00:27
@SimonCropp
SimonCropp merged commit f8b30f1 into main Oct 12, 2026
3 checks passed
@SimonCropp
SimonCropp deleted the fix/string-join-span-recursion branch October 12, 2026 01:03
This was referenced Oct 12, 2026
This was referenced Oct 14, 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.

1 participant