Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/libraries/System.Private.CoreLib/src/System/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ public override string ToString() =>

public string ToString(int fieldCount)
{
Span<char> dest = stackalloc char[(4 * Number.Int32NumberBufferLength) + 3]; // at most 4 Int32s and 3 periods
// at most 4 non-negative Int32s and 3 periods: 2147483647.2147483647.2147483647.2147483647
const int MaximumVersionLength = 43;
Span<char> dest = stackalloc char[MaximumVersionLength];
bool success = TryFormat(dest, fieldCount, out int charsWritten);
Debug.Assert(success);
return dest.Slice(0, charsWritten).ToString();
Expand Down