Skip to content

Commit 5daa0c1

Browse files
committed
Add debugger display for ValueStringBuilder.
1 parent 5bcabbe commit 5daa0c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sdk/src/Core/ThirdParty/RuntimeBackports/ValueStringBuilder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace ThirdParty.RuntimeBackports
1414
{
15+
[DebuggerDisplay("{DebuggerDisplay,nq}")]
1516
#pragma warning disable CA1815
1617
internal ref struct ValueStringBuilder
1718
#pragma warning restore CA1815
@@ -45,6 +46,9 @@ public int Length
4546
}
4647
}
4748

49+
// ToString() has side effects, so we don't want to call it from the debugger display.
50+
private string DebuggerDisplay => AsSpan().ToString();
51+
4852
public int Capacity => _chars.Length;
4953

5054
public void EnsureCapacity(int capacity)

0 commit comments

Comments
 (0)