1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-21 01:18:02 +02:00

Fix for Debug.WriteLine() - Avoid potential String reallocation

Debug.WriteLine() no longer reallocate its scoped String when appending a newline.
This only happened when the StringView length  matches the buffersize in the String.
This commit is contained in:
m910q 2022-01-06 22:10:52 +01:00
parent d778f2dd2f
commit 80f72fd35e

View file

@ -70,7 +70,7 @@ namespace System.Diagnostics
public static void WriteLine(StringView line)
{
String lineStr = scope String(Math.Min(line.Length, 4096));
String lineStr = scope String(Math.Min(line.Length + 1, 4096));
lineStr.Append(line);
lineStr.Append('\n');
Write(lineStr.Ptr, lineStr.Length);