Skip to content

Commit 6568966

Browse files
committed
tmp
1 parent 8e0a0ad commit 6568966

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

src/Components/Endpoints/src/Rendering/Buffering/TextChunk.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics;
5+
using System.Globalization;
46
using System.Text;
57

68
namespace Microsoft.AspNetCore.Components.Endpoints.Rendering;
79

810
// Holds different types of outputs that can be written to BufferedTextWriter
11+
12+
[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")]
913
internal readonly struct TextChunk
1014
{
1115
private readonly TextChunkType _type;
@@ -74,4 +78,16 @@ public Task WriteToAsync(TextWriter writer, string charArraySegments, ref String
7478
}
7579

7680
private enum TextChunkType { Int, String, Char, CharArraySegment };
81+
82+
internal string GetDebuggerDisplay()
83+
{
84+
return _type switch
85+
{
86+
TextChunkType.String => _stringValue!,
87+
TextChunkType.Char => $"{_charValue}",
88+
TextChunkType.CharArraySegment => "<<Buffer>>",
89+
TextChunkType.Int => _intValue.ToString(CultureInfo.InvariantCulture),
90+
_ => throw new NotImplementedException(),
91+
};
92+
}
7793
}

src/Components/Endpoints/src/Rendering/Buffering/TextChunkPage.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics;
5+
using System.Text;
6+
47
namespace Microsoft.AspNetCore.Components.Endpoints.Rendering;
58

69
// Used internally by TextChunkListBuilder
10+
[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")]
711
internal class TextChunkPage
812
{
913
private readonly TextChunk[] _buffer;
@@ -40,4 +44,15 @@ public void Clear()
4044
{
4145
_count = 0;
4246
}
47+
48+
private string GetDebuggerDisplay()
49+
{
50+
var sb = new StringBuilder();
51+
for (var i = 0; i < _count; i++)
52+
{
53+
sb.Append(_buffer[i].GetDebuggerDisplay());
54+
}
55+
56+
return sb.ToString();
57+
}
4358
}

src/Components/test/E2ETest/Tests/StatePersistenceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void CanRenderComponentWithPersistedState(bool suppressEnhancedNavigation
117117
// For server we validate that the state is provided every time a circuit is initialized.
118118
[Theory]
119119
[InlineData(typeof(InteractiveServerRenderMode), (string)null)]
120-
[InlineData(typeof(InteractiveServerRenderMode), "ServerStreaming", Skip = "Streaming not yet supported")]
120+
[InlineData(typeof(InteractiveServerRenderMode), "ServerStreaming")]
121121
[InlineData(typeof(InteractiveWebAssemblyRenderMode), (string)null)]
122122
[InlineData(typeof(InteractiveWebAssemblyRenderMode), "WebAssemblyStreaming", Skip = "Streaming not yet supported")]
123123
[InlineData(typeof(InteractiveAutoRenderMode), (string)null)]

0 commit comments

Comments
 (0)