Repository navigation
Copy only formatted data into right-aligned buffer output - #152
Open
dajiaohuang wants to merge 1 commit into
Open
dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Right-aligned numeric formatting copies the entire scratch span rather than the formatted portion. A valid small buffer writer therefore throws even though it provides the requested capacity:
The same root affects UTF16/UTF8 prepared
FormatTo, and UTF8 builderAppendFormatwhen close to its buffer capacity.IBufferWriter.GetSpan(charsWritten)does not promise enough space for the unused remainder of the scratch buffer.Change
Copy only
s.Slice(0, charsWritten). Update the canonicalFormatHelper.tt, regenerateFormatHelper.csusing dotnet-t4 3.0.0, and apply the same correction to the non-generated UTF8 builder path. Unity copies are produced by the existing netstandard2.1 post-build target. The generator also emits the generated helper without its previous BOM.No alignment-width, Unicode-counting, numeric-format, or formatter-contract changes are included; this is separate from #128 / #146.
Validation
DOTNET_ROLL_FORWARD=Majorbecause .NET 7 runtime is unavailable locally. No Unity editor/TMP/IL2CPP execution or performance claims.