You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test run aborts when a .NET Framework test name contains an unpaired surrogate (regression in 18.11) #16512
Since the runner started deserializing test host messages with System.Text.Json, a single test whose display name contains an unpaired UTF-16 surrogate aborts the whole run on .NET Framework:
The active test run was aborted. Reason: The JSON value could not be converted to Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase. Path: $ | LineNumber: 0 | BytePositionInLine: 1413.
The inner exception is:
System.InvalidOperationException: Cannot read incomplete UTF-16 JSON text as string with missing low surrogate.
testhost.net472.exe serializes with Jsonite (JsonDataSerializer: Using Jsonite serializer in the host diag log) and writes the lone high surrogate as the escape \uD83D. The runner reads the message with System.Text.Json (JsonDataSerializer.Stj.cs, TestRequestSender.OnExecutionMessageReceived), which rejects unpaired surrogates by design. Every result after that point is lost.
Unpaired surrogates are easy to hit without intending to: xUnit v2 truncates long string arguments in theory display names by UTF-16 length, so any emoji in theory data can be cut in half.
usingXunit;publicclassTests{// xUnit v2 truncates long string arguments in the display name. The leading "a" makes// the cut fall between the two UTF-16 halves of an emoji, leaving a lone high surrogate.[Theory][InlineData("a😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀")]publicvoidLongEmojiArgument(stringvalue)=>Assert.NotEmpty(value);[Fact]publicvoidOther(){}}
Then dotnet test -f net472.
Expected behavior
Both tests pass, as they do with SDK 10.0.400. At worst, the one affected result is reported with a replaced character; the run should not abort.
Actual behavior
SDK
vstest
net472
net10.0
10.0.400
18.7.0-release-26379-115
Passed (2/2)
Passed (2/2)
11.0.100-rc.1.26425.128
18.11.0-preview-26425-128
Test Run Aborted
Passed (2/2)
Changing the prefix to "ab", so the truncation falls between two emoji, makes net472 pass on SDK 11 as well.
Microsoft.TestPlatform.CommunicationUtilities.dll references Newtonsoft.Json in 18.7 and System.Text.Json in 18.11, which matches the regression window.
Thanks for the detailed repro and root-cause analysis! This is already being addressed by open PR #16513 ("Don't abort the run on an unpaired surrogate in a test name"), which closes this issue. Marking as in-progress and skipping duplicate work here.
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
github.com
southcentralus0.in.applicationinsights.azure.com
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
Activity
MihuBot commentedon Sep 23, 2026
I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):
github-actions commentedon Sep 23, 2026
Thanks for the detailed repro and root-cause analysis! This is already being addressed by open PR #16513 ("Don't abort the run on an unpaired surrogate in a test name"), which closes this issue. Marking as in-progress and skipping duplicate work here.
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
github.comsouthcentralus0.in.applicationinsights.azure.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.