Skip to content

[rel/4.5] Handle uncorrelated JSON-RPC errors without ending MTP sessions - #12286

Merged
Amaury Levé (Evangelink) merged 1 commit into
rel/4.5from
dev/amauryleve/rider-null-id-backport
Nov 9, 2026
Merged

Amaury Levé (Evangelink) merged 1 commit into
rel/4.5from
dev/amauryleve/rider-null-id-backport

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Backport of #12283 to rel/4.5 for MSTest 4.5.3 / MTP 2.5.3.

Relates to #12261. This is a non-closing servicing reference; the issue discussion remains coordinated by the main PR.

Accept explicit id: null only on genuine JSON-RPC error envelopes. Diagnose an uncorrelated error without replying, completing another pending call, coercing the ID to zero, or leaking server request-counter accounting. Keep the existing request, success, cancellation, numeric-ID and canonical-string-ID rules. Pending client calls still require a later correlated response, cancellation, EOF or disposal; this does not recover lost messages.

The cherry-pick -x retains the original co-author trailer. Release-only adaptations preserve the branch's serializer style and internal API baseline, recreate only the new host regression and its minimal fixture because main's host test file is absent here, use the release's packed net8.0/net9.0 server assets and net8.0 source-client slice, and retain both new Windows net48 cases. No new public API, malformed-frame recovery, capability, timeout, Unicode/ASCII-escaping workaround, or test serialization was introduced.

Test-value evidence

All evidence below was executed on this servicing branch, not inherited from main:

  • Release base: a39964ce2cf09c4abcbaa7bb8f4e5818638a9de3.
  • Validated backport head: 88b4bd31a13875e890bde34e21087c80c4e6c357.
  • Original main fix: 9ab03e7774cb99667362e88e0157dc2d10e89fb1, from main source base 127798de9bd5c3f7204dc8932cddf043bf4bd6c6.
  • Repository-pinned SDK: 12.0.100-alpha.1.26480.103; Windows desktop MSBuild; Debug shipping packages.
Run TFM Independently discovered / TRX results Passed Existing Unix-only skips Exit
core net8.0 147 147 0 0
core net9.0 147 147 0 0
core net462 147 147 0 0
client net8.0 300 292 8 0
client net462 211 209 2 0
acceptance net11.0 17 17 0 0

The 952 unit results comprise 942 passed and 10 existing OS-conditioned Unix skips. All 96 new unit-regression executions passed. Every discovered UID matched exactly one TRX result, including all data rows; six nonempty TRX files were parsed, not inferred from process exit codes. All 17 acceptance/source-package cases executed and passed, with no skips or retry masking, retaining assembly-level MethodLevel scheduling and unique per-test generated assets. The protocol schema's 15 positive/negative envelope cases also passed.

The new unit cases cover null-error payload preservation/explicit-null serialization, malformed and missing-ID envelopes, normal success/cancellation rejection, non-null ID-kind preservation, throwing diagnostic sinks, pending response/cancellation/EOF/disposal paths, and JsonRpcConnection_NullIdError_DoesNotCompleteRequestZero. In particular, both logger rows of RunAsync_NullIdErrorsAreDiagnosedWithoutLeakingRequestCounts passed on all three core TFMs, and all five rows of RunTestsAsync_NullIdErrors_PreservePendingRequestLifecycle passed on both source-client TFMs.

Real packaged regression Shipping layout / consumer Result
PackagedServer_NullIdErrorsPreserveDiscoveryExecutionAndExit net8.0, net9.0 Both passed; repeated raw null-ID errors, exact discovered/executed node and graceful exit 0
PackagedFrameworkServer_NullIdErrorsPreserveDiscoveryExecutionAndExit Windows net48 server using netstandard2.0 platform asset Passed; same wire and exit assertions
PackagedFrameworkConsumer_NullIdErrorIsAcceptedAndRealServerRemainsUsable Windows net48 packed source client using Jsonite, real net8.0 server Passed
PackagedConsumer_LaunchesRealServer_DiscoversAndRunsExpectedNode net8.0 packed source client using System.Text.Json, real net8.0 server Passed

The two already-built packaged consumer executables were additionally launched directly. Both parent exits were 0 and both logs contained UNCORRELATED ERROR ACCEPTED, DISCOVERED TestMethod1, EXECUTED TestMethod1, and OK. Nine consumer/server build binlogs were captured. The existing hostile-consumer compilation covered net462, netstandard2.0, and net5.0 through net8.0 with C# 12 and warnings as errors; the default-language consumer retained the SDK's default language version.

Shipping provenance

Package Actual local package version SHA-256
Microsoft.Testing.Platform.2.5.3-dev.nupkg 2.5.3-dev 6CD097C0F8EC92D99372C239DDACCBE51D63017181DE4D9503EE94B8AF2ACEC8
Microsoft.Testing.Platform.ServerMode.Client.Sources.2.5.3-dev.nupkg 2.5.3-dev 483DAADB5BF7436086723766968978988454A061FB0FCC8FD9F88AC9D8741D2A

The source package actually contains netstandard2.0, net5.0 compatibility, and net8.0 content slices. Both runnable consumers restored its exact matching ZIP payload into their own isolated cache: modern net8.0 selected the net8.0 slice; Windows net48 selected netstandard2.0. The machine's existing Visual Studio offline fallback folder was present but was not the source-package payload used. No shared cache, user, or machine setting was changed.

The server tests asserted the actual loaded DLL path via SERVER-ASSEMBLY and byte equality with the .nupkg entry before checking wire behavior. Independently confirmed DLLs have product version 2.5.3-dev (the normal local Arcade file-version placeholder is 42.42.42.42424):

Actual server TFM Platform package asset Loaded DLL SHA-256
net8.0 lib/net8.0/Microsoft.Testing.Platform.dll 9207D6C2BC4B5A70A4375C6CDBA5C946392E1CAAA4E8E0B61FA4A7A2261A6372
net9.0 lib/net9.0/Microsoft.Testing.Platform.dll CBB6A4EB148D5FBE5B06B1CB2F1E0AABF68B87362E275FE0A66C5A51651335F6
net48 lib/netstandard2.0/Microsoft.Testing.Platform.dll C1460950D23F124FC561F8586D46454EE158F26F8AD113C6653EA832B6696BB5

Exact executed commands and results

All shell environments were process-local: repository .dotnet first on a bounded PATH, MSBUILDDISABLENODEREUSE=1, DOTNET_CLI_USE_MSBUILD_SERVER=0, and an isolated NUGET_PACKAGES at artifacts\obj\n.

Complete pack, independent discovery, TRX executions and direct composed-product commands

Complete pack — exit 0, 0 warnings, 0 errors:

.\build.cmd -pack -c Debug -msbuildEngine vs -projects TestFx.slnx /bl:C:\Users\amauryleve\.copilot\session-state\eed670f4-3d02-4de2-abf8-7ec089e3194c\files\pack-3b8d6b748e6a44a499c530a409c5030b.binlog /nr:false

Protocol schema — exit 0, all 15 cases passed:

& "C:\Users\amauryleve\AppData\Local\Programs\Python\Python312\python.exe" "C:\Users\amauryleve\.copilot\session-state\eed670f4-3d02-4de2-abf8-7ec089e3194c\files\Verify-BackportSchema.py" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention" "C:\Users\amauryleve\.copilot\session-state\eed670f4-3d02-4de2-abf8-7ec089e3194c\files\schema-evidence.json"

core / net8.0 — discovery exit 0; execution exit 0; 147 passed, 0 existing Unix-only skips; TRX 224799 bytes:

& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\.dotnet\dotnet.exe" "exec" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.UnitTests\Debug\net8.0\Microsoft.Testing.Platform.UnitTests.dll" "--no-banner" "--filter" "FullyQualifiedName~FormatterUtilitiesTests|FullyQualifiedName~RpcIdParserTests|FullyQualifiedName~ServerTestHostTests" "--list-tests" "json"
& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\.dotnet\dotnet.exe" "exec" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.UnitTests\Debug\net8.0\Microsoft.Testing.Platform.UnitTests.dll" "--no-banner" "--filter" "FullyQualifiedName~FormatterUtilitiesTests|FullyQualifiedName~RpcIdParserTests|FullyQualifiedName~ServerTestHostTests" "--report-trx" "--report-trx-filename" "core-net8.0-5f3263d512c74da783f8b0192a386588.trx" "--results-directory" "C:\Users\amauryleve\.copilot\session-state\eed670f4-3d02-4de2-abf8-7ec089e3194c\files\results-core-net8.0-5f3263d512c74da783f8b0192a386588" "--minimum-expected-tests" "1"

core / net9.0 — discovery exit 0; execution exit 0; 147 passed, 0 existing Unix-only skips; TRX 224799 bytes:

& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\.dotnet\dotnet.exe" "exec" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.UnitTests\Debug\net9.0\Microsoft.Testing.Platform.UnitTests.dll" "--no-banner" "--filter" "FullyQualifiedName~FormatterUtilitiesTests|FullyQualifiedName~RpcIdParserTests|FullyQualifiedName~ServerTestHostTests" "--list-tests" "json"
& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\.dotnet\dotnet.exe" "exec" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.UnitTests\Debug\net9.0\Microsoft.Testing.Platform.UnitTests.dll" "--no-banner" "--filter" "FullyQualifiedName~FormatterUtilitiesTests|FullyQualifiedName~RpcIdParserTests|FullyQualifiedName~ServerTestHostTests" "--report-trx" "--report-trx-filename" "core-net9.0-3d6f43f138c449eeb70f22ef3bddf13b.trx" "--results-directory" "C:\Users\amauryleve\.copilot\session-state\eed670f4-3d02-4de2-abf8-7ec089e3194c\files\results-core-net9.0-3d6f43f138c449eeb70f22ef3bddf13b" "--minimum-expected-tests" "1"

core / net462 — discovery exit 0; execution exit 0; 147 passed, 0 existing Unix-only skips; TRX 224796 bytes:

& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.UnitTests\Debug\net462\Microsoft.Testing.Platform.UnitTests.exe" "--no-banner" "--filter" "FullyQualifiedName~FormatterUtilitiesTests|FullyQualifiedName~RpcIdParserTests|FullyQualifiedName~ServerTestHostTests" "--list-tests" "json"
& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.UnitTests\Debug\net462\Microsoft.Testing.Platform.UnitTests.exe" "--no-banner" "--filter" "FullyQualifiedName~FormatterUtilitiesTests|FullyQualifiedName~RpcIdParserTests|FullyQualifiedName~ServerTestHostTests" "--report-trx" "--report-trx-filename" "core-net462-fc6df4f0239549a6bf370856f10899e2.trx" "--results-directory" "C:\Users\amauryleve\.copilot\session-state\eed670f4-3d02-4de2-abf8-7ec089e3194c\files\results-core-net462-fc6df4f0239549a6bf370856f10899e2" "--minimum-expected-tests" "1"

client / net8.0 — discovery exit 0; execution exit 0; 292 passed, 8 existing Unix-only skips; TRX 490588 bytes:

& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\.dotnet\dotnet.exe" "exec" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests\Debug\net8.0\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests.dll" "--no-banner" "--list-tests" "json"
& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\.dotnet\dotnet.exe" "exec" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests\Debug\net8.0\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests.dll" "--no-banner" "--report-trx" "--report-trx-filename" "client-net8.0-3869634b3e48461ab44262821646b5e7.trx" "--results-directory" "C:\Users\amauryleve\.copilot\session-state\eed670f4-3d02-4de2-abf8-7ec089e3194c\files\results-client-net8.0-3869634b3e48461ab44262821646b5e7" "--minimum-expected-tests" "1"

client / net462 — discovery exit 0; execution exit 0; 209 passed, 2 existing Unix-only skips; TRX 345105 bytes:

& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests\Debug\net462\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests.exe" "--no-banner" "--list-tests" "json"
& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests\Debug\net462\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests.exe" "--no-banner" "--report-trx" "--report-trx-filename" "client-net462-b79a46116d7c49aa9ae11e5582275c63.trx" "--results-directory" "C:\Users\amauryleve\.copilot\session-state\eed670f4-3d02-4de2-abf8-7ec089e3194c\files\results-client-net462-b79a46116d7c49aa9ae11e5582275c63" "--minimum-expected-tests" "1"

acceptance / net11.0 — discovery exit 0; execution exit 0; 17 passed, 0 existing Unix-only skips; TRX 30709 bytes:

& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\.dotnet\dotnet.exe" "exec" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.Acceptance.IntegrationTests\Debug\net11.0\Microsoft.Testing.Platform.Acceptance.IntegrationTests.dll" "--no-banner" "--filter" "(FullyQualifiedName~MtpServerClientPackagedConsumerRunTests&FullyQualifiedName!~PackagedNet6Consumer)|FullyQualifiedName~MtpServerClientSourcePackageConsumerTests|FullyQualifiedName~MtpServerClientSourcePackageTests" "--list-tests" "json"
& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\.dotnet\dotnet.exe" "exec" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\bin\Microsoft.Testing.Platform.Acceptance.IntegrationTests\Debug\net11.0\Microsoft.Testing.Platform.Acceptance.IntegrationTests.dll" "--no-banner" "--filter" "(FullyQualifiedName~MtpServerClientPackagedConsumerRunTests&FullyQualifiedName!~PackagedNet6Consumer)|FullyQualifiedName~MtpServerClientSourcePackageConsumerTests|FullyQualifiedName~MtpServerClientSourcePackageTests" "--report-trx" "--report-trx-filename" "acceptance-net11.0-c3403f431131447db466968e4d7ec6ab.trx" "--results-directory" "C:\Users\amauryleve\.copilot\session-state\eed670f4-3d02-4de2-abf8-7ec089e3194c\files\results-acceptance-net11.0-c3403f431131447db466968e4d7ec6ab" "--minimum-expected-tests" "1"

Direct packed net8.0 consumer — exit 0, all four required markers:

& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\tmp\Debug\testsuite\32cc3\MtpServerClientPackagedRun-net8.0\PackagedConsumer\bin\Debug\net8.0\PackagedConsumer.exe" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\tmp\Debug\testsuite\32cc3\MtpServerClientPackagedRun-net8.0\DummyApp\bin\Debug\net8.0\DummyApp.exe"

Direct packed net48 consumer — exit 0, all four required markers:

& "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\tmp\Debug\testsuite\XHuZb\MtpServerClientPackagedRun-net48\PackagedConsumer\bin\Debug\net48\PackagedConsumer.exe" "Q:\src\copilot-worktrees\testfx\dev-amauryleve-symmetrical-invention\artifacts\tmp\Debug\testsuite\XHuZb\MtpServerClientPackagedRun-net48\DummyApp\bin\Debug\net8.0\DummyApp.exe"

Boundaries and cleanup

No product or infrastructure blocker remains. The initial complete-pack attempt failed in the F# sample because its isolated-cache reference path was 268 characters; the file existed. Moving only this worktree's cache to artifacts\obj\n shortened that reference to 249 characters, and the complete unchanged-source pack then passed. That setup failure is not counted as behavioral red evidence.

Rider's reported Unicode parser trigger and actual IDE recovery remain unverified. Unix-only cases and an official signed/Release configuration were not executed on this Windows Debug run. Main's buildable deserializer-only counterfactual is documented in #12283; it was not rerun here and is not claimed as release proof.

After verification, 14 generated temporary asset directories and the nine original temporary build binlogs were removed only after preserving hashes, commands, six TRX files, project-assets snapshots, binary shipping layouts, stdout, and binlog copies in this session's evidence folder. No owned test processes remain. This worktree and its aligned packages are retained to own the open servicing PR. Nothing was merged or closed.

Accept explicit null IDs only for genuine error responses. Preserve request correlation and shutdown accounting across the platform and source-only client, with modern and Framework packaged regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 9ab03e7)
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Final test-triage resolution — Azure Pipelines build 1670978

Analysis is final and the evidence is complete. The PR head and merge SHAs match the build's SHAs. History from up to 12 prior builds on rel/4.5 is complete and shows no prior occurrences of these signatures. 58 candidates were reviewed, of which 8 were failed or retried records and 50 were slow-only; none of the slow candidates is a regression.

1. Probable PR-related failure: PackagedNet6Consumer_WhenSiblingApphostCannotExecute_RetriesThroughDotnet (Linux Release, Microsoft.Testing.Platform.Acceptance.IntegrationTests net11.0)

  • The test asserts that the packaged consumer compiles. The generated PackagedConsumer/Program.cs(40,82) fails with error CS1503: Argument 1: cannot convert from 'byte[]' to 'string', in the MtpServerClientPackagedRun-net6.0 asset.
  • This is a deterministic compile error in injected source, not a timing or environment problem. It looks like a mismatch between the packaged MTP server-client API and the injected consumer code, which this PR's JSON-RPC changes could plausibly cause.
  • Confidence: medium-high. Next step: check which API at Program.cs line 40 now takes byte[] versus string on the rel/4.5 merge, and align the test source or the API change.

2. Likely flake or timing-sensitive: QueryInProgressTestsWithTimeout_WhenTimeoutElapses_CancelsTheRequestToken (Windows Debug, Microsoft.Testing.Extensions.UnitTests net472, HangDumpTests)

  • It failed on Assert.IsTrue(requestCancellationToken.IsCancellationRequested) in one leg only, and no retry or other leg is recorded.
  • Confidence: low. This is not proven flaky, because there is no fail-then-pass evidence. Re-run the leg; if it recurs, investigate the timeout-versus-cancellation race.

3. Expected, not defects: NativeTests.Outcome (×4), WinUIMtpPackagedApp.UnitTest1.RetryFailsFirstAttempt and PackagedWinUI...RetryTestMethod_PassesOnSecondAppContainerHost come from the Windows App Model diagnostics artifacts. Their messages ("expected host failure", "deliberately fails the first retry attempt", "first AppContainer host fails so Retry must activate a second host") show they are intentional probe fixtures for the Retry and native-sidecar tests. They should not be treated as product failures.

No crash or hang diagnostics were collected. No issue is created, since the durable-issue thresholds are not met. Finding 1 should be fixed in this PR.

🤖 Automated content by GitHub Copilot. Generated by the Pipeline Test Triage workflow. · copilot · auto · ~28 AIC · ⌖ ~1 AIC · ⊞ 10K

@Evangelink
Amaury Levé (Evangelink) merged commit 2e9f40b into rel/4.5 Nov 9, 2026
29 of 32 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/rider-null-id-backport branch November 9, 2026 18:38
@github-actions github-actions Bot removed the state/approved Proposal approved; ready for implementation. label Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants