1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-23 10:08:00 +02:00

Merge pull request #1356 from m910q/FixDebugWriteLineReallocation

Fix for Debug.WriteLine() - Avoid potential String reallocation
This commit is contained in:
Brian Fiete 2022-01-07 12:43:28 +01:00 committed by GitHub
commit 94a262d92c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,7 +70,7 @@ namespace System.Diagnostics
public static void WriteLine(StringView line) 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(line);
lineStr.Append('\n'); lineStr.Append('\n');
Write(lineStr.Ptr, lineStr.Length); Write(lineStr.Ptr, lineStr.Length);