Description
The generated Parse and TryParse methods for repeating sections use a fixed-size stack-allocated buffer:
Span<Range> tagsRanges = stackalloc Range[128];
If a key contains more than 128 items in a repeating section, MemoryExtensions.Split will silently truncate the results. This produces an incorrect parse result rather than a clear error.
Reproduction
Visible in the snapshot baseline:
SourceGeneratorSnapshotTests.RepeatingPropertyCompositeKey_SourceOutput#UnitTests.UserTagKey.g.verified.cs (lines ~184-185 for Parse, ~235 for TryParse)
Expected behaviour
The generated code should either:
- Detect when the buffer is exhausted (i.e.
tagsCount == 128) and fall back to a heap allocation or return a clear error
- Or document the 128-item limit as a known constraint
Discovered via
Snapshot testing added in #48 — this is a pre-existing generator issue, not a regression.