Skip to content

Show currently running tests in dotnet test MTP output (#49712) - #54486

Merged
Evangelink merged 3 commits into
mainfrom
dev/amauryleve/show-active-tests
Jun 1, 2026
Merged

Show currently running tests in dotnet test MTP output (#49712)#54486
Evangelink merged 3 commits into
mainfrom
dev/amauryleve/show-active-tests

Conversation

@Evangelink

@Evangelink Evangelink commented May 28, 2026

Copy link
Copy Markdown
Member

Fixes #49712.

What

Surfaces currently-running tests in the dotnet test output for projects using Microsoft.Testing.Platform (MTP). The SDK already has all of the rendering machinery for this (TestProgressState/TestNodeResultsState/AnsiTerminalTestProgressFrame — including the ... and X more trimming), but it was dead code because:

  1. The IPC protocol carried no test started event for MTP, only TestResultMessages.
  2. TerminalTestReporterOptions.ShowActiveTests was never set.

This PR addresses both.

Changes

  • New IPC messageTestInProgressMessages model + TLV serializer registered with id 10. Mirrors DiscoveredTestMessages.
  • Dispatch + handlerTestApplication.OnRequest dispatches the new message; TestApplicationHandler.OnTestInProgressReceived validates the execution id and forwards each item to the reporter.
  • ReporterTerminalTestReporter.TestInProgress now takes the same (assembly, tfm, arch, executionId, instanceId, uid, displayName) shape as TestCompleted.
  • StateTestNodeResultsState keys running tests by (instanceId, uid) instead of just uid, and tracks a completed set so a late in-progress notification can never resurrect a finished test. Retries (which get a new instanceId) are surfaced correctly.
  • Default-onShowActiveTests is enabled when AnsiMode == AnsiIfPossible and progress isn't suppressed (so it stays off in CI, --no-ansi, --no-progress, and LLM environments).

Back-compat

The named-pipe protocol is not versioned for this change because TLV with unknown-id skip is sufficient:

  • Old SDK + new MTPNamedPipeServer is constructed with skipUnknownMessages: true and TestApplication.OnRequest already returns VoidResponse for UnknownMessage, so the events are dropped silently.
  • New SDK + old MTP — old MTPs simply never send the message, so the running-tests panel stays empty (which is what users see today).

No protocol version bump is needed.

Producer-side gating (concern from @nohwnd)

@nohwnd flagged in #49712 that 12 parallel processes flooding test started events for fast tests would be noisy. Mitigations in this PR:

  • The existing per-assembly ... and X more trimming in TestNodeResultsState.GetRunningTasks already handles bursty cases.
  • The stale-add guard means stragglers that arrive after a test result don't pollute the panel.

The companion MTP-side PR is microsoft/testfx#8652, which actually emits the new TestInProgressMessages from DotnetTestDataConsumer on InProgressTestNodeStateProperty. A further producer-side slow-test threshold (e.g. only emit after N ms) could be added there as a follow-up.

Tests

  • TestInProgressMessagesSerializerTests — round-trip with populated and empty payloads; pins serializer id to 10.
  • TestNodeResultsStateTests — stale-add suppression after completion, retry path (new instanceId re-adds), distinct (instanceId, uid) keying.

All 6 new tests pass.

Adds a new TestInProgressMessages IPC message type (serializer id 10) so that the test platform can notify the SDK when a test starts. The SDK already has rendering machinery for in-progress tests (TestProgressState, TestNodeResultsState, AnsiTerminalTestProgressFrame, including the '... and X more' trimming) but it was dead because the protocol carried no 'test started' event and ShowActiveTests was never enabled.

Changes:

* IPC layer: new TestInProgressMessages model + TLV serializer, registered with id 10. Back-compat is preserved by the TLV format (unknown field ids are skipped) and NamedPipeServer skipUnknownMessages, so old SDKs paired with new MTPs continue to work and vice-versa.

* Handler: TestApplicationHandler.OnTestInProgressReceived forwards each event to TerminalTestReporter.TestInProgress(assembly, tfm, arch, executionId, instanceId, uid, displayName).

* State: TestNodeResultsState now keys running tests by (instanceId, uid) and tracks a completed set, so a stale in-progress notification arriving after the matching test result cannot resurrect a 'running' entry. Retries (new instanceId) are still surfaced correctly.

* Default-on: ShowActiveTests is enabled when AnsiMode == AnsiIfPossible and progress is not suppressed, so it stays off in CI, --no-ansi, --no-progress and LLM environments.

* Tests: round-trip + serializer id assertion for the new serializer, plus stale-add suppression / retry handling for TestNodeResultsState.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 28, 2026 10:36
@Evangelink
Evangelink requested a review from a team as a code owner May 28, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables live display of currently running tests in dotnet test for Microsoft.Testing.Platform by adding an IPC message for in-progress tests and wiring it into the existing terminal progress renderer.

Changes:

  • Adds TestInProgressMessages IPC model, serializer, field IDs, and serializer registration.
  • Dispatches in-progress test events through TestApplicationHandler into TerminalTestReporter.
  • Updates active-test state tracking to key by (instanceId, uid) and adds tests for serializer and state behavior.
Show a summary per file
File Description
src/Cli/dotnet/Commands/Test/MTP/IPC/Models/TestInProgressMessages.cs Adds IPC records for running-test notifications.
src/Cli/dotnet/Commands/Test/MTP/IPC/ObjectFieldIds.cs Reserves field and serializer IDs for in-progress test messages.
src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/RegisterSerializers.cs Registers the new serializer.
src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/TestInProgressMessagesSerializer.cs Implements TLV serialization for in-progress test messages.
src/Cli/dotnet/Commands/Test/MTP/TestApplication.cs Routes the new message type to the handler.
src/Cli/dotnet/Commands/Test/MTP/TestApplicationHandler.cs Validates and forwards running-test notifications to the reporter.
src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs Adds instance-aware active-test updates and removal.
src/Cli/dotnet/Commands/Test/MTP/Terminal/TestNodeResultsState.cs Tracks running tests by instance and suppresses stale completed entries.
src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs Enables active-test display for ANSI progress mode.
test/dotnet.Tests/CommandTests/Test/TestInProgressMessagesSerializerTests.cs Adds serializer round-trip and ID coverage.
test/dotnet.Tests/CommandTests/Test/TestNodeResultsStateTests.cs Adds coverage for stale-add suppression and retry keying.

Copilot's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 1
Evangelink and others added 2 commits May 29, 2026 08:50
…pability

The ShowActiveTests option is set based on the requested AnsiMode, but
TerminalTestReporter may decide at runtime to disable progress (e.g. when
stdout is redirected, console is non-TTY, or ANSI codes aren't accepted).
In that case the incoming TestInProgress events would still allocate and
update TestNodeResultsState even though nothing can ever be rendered.

Compute an effective _showActiveTests in the ctor as
_options.ShowActiveTests && showProgress and use it to gate both the
AddRunningTestNode and RemoveRunningTestNode paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink
Evangelink merged commit cf7f1ff into main Jun 1, 2026
25 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/show-active-tests branch June 1, 2026 09:21
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 2, 2026
baronfel added a commit to dotnet/core that referenced this pull request Jul 10, 2026
Document the in-flight test progress panel (dotnet/sdk#54486) and fix
pre-existing trailing-space lint errors in the NativeAOT section.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
baronfel added a commit to dotnet/core that referenced this pull request Jul 10, 2026
* [release-notes] .NET SDK in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Clarify NativeAOT CLI updates in preview6/sdk.md

Updated the NativeAOT CLI section to clarify the unification of managed and NativeAOT parsers, and removed filtered content related to internal changes.

* Add live running-tests display to dotnet test notes

Document the in-flight test progress panel (dotnet/sdk#54486) and fix
pre-existing trailing-space lint errors in the NativeAOT section.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Chet Husk <baronfel@users.noreply.github.com>
Co-authored-by: Chet Husk <chusk3@gmail.com>
rbhanda added a commit to dotnet/core that referenced this pull request Jul 14, 2026
* [release-notes] .NET 11 Preview 6 base metadata

changes.json, features.json, build-metadata.json, and README for the
.NET 11 Preview 6 milestone (VMR base v11.0.0-preview.5.26302.115 ->
head release/11.0.1xx-preview6).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* [release-notes] C# in .NET 11 Preview 6 (#10460)

* [release-notes] C# in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update release-notes/11.0/preview/preview6/csharp.md

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Bill Wagner <wiwagn@microsoft.com>

* [release-notes] MSBuild in .NET 11 Preview 6 (#10463)

* [release-notes] MSBuild in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add bug-fix note for architecture-agnostic Runtime=NET task host handshake (dotnet/msbuild#13890)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Remove HTML comments from Preview 6 MSBuild release notes

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Chet Husk <chusk3@gmail.com>

* [release-notes] NuGet in .NET 11 Preview 6 (#10464)

* [release-notes] NuGet in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix STJ feature-flag env var value and remove VS reference

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Chet Husk <chusk3@gmail.com>

* [release-notes] .NET SDK in .NET 11 Preview 6 (#10459)

* [release-notes] .NET SDK in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Clarify NativeAOT CLI updates in preview6/sdk.md

Updated the NativeAOT CLI section to clarify the unification of managed and NativeAOT parsers, and removed filtered content related to internal changes.

* Add live running-tests display to dotnet test notes

Document the in-flight test progress panel (dotnet/sdk#54486) and fix
pre-existing trailing-space lint errors in the NativeAOT section.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Chet Husk <baronfel@users.noreply.github.com>
Co-authored-by: Chet Husk <chusk3@gmail.com>

* [release-notes] Windows Forms in .NET 11 Preview 6 (#10465)

* [release-notes] Windows Forms in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Revise Windows Forms release notes for Preview 6

Updated release notes for .NET 11 Preview 6 to include bug fixes and improvements for various Windows Forms components.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Klaus Löffelmann <9663150+KlausLoeffelmann@users.noreply.github.com>

* [release-notes] .NET MAUI in .NET 11 Preview 6 (#10467)

* [release-notes] .NET MAUI in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Draft .NET MAUI and friends notes for .NET 11 Preview 6

Combined highlights for .NET MAUI, .NET for Android, and .NET for iOS,
Mac Catalyst, macOS, and tvOS: CollectionView2 on Windows, handler-based
Shell on Android, Compatibility package removal, AOT-safe HybridWebView,
Geolocation minimum-distance filter, a reliability wave, the
AndroidMessageHandler HTTP-contract work, and the Apple platform toolchain
and NSUrlSessionHandler updates.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Add Preview 6 items from MAUI maintainer review

Incorporates jfversluis review feedback on #10467:
- Android MediaPicker result recovery APIs (dotnet/maui#35455)
- HybridWebView Android message-source filtering (dotnet/maui#35717)
- XAML C# expression source generator CS1061 fix (dotnet/maui#35922)
- Testable permissions via IPermissions/Permissions.Current (dotnet/maui#35987)
- XA0149 warning for legacy __AndroidEnvironment__ resources (dotnet/android#11700)
- Skip library proguard.txt with disallowed R8 global options (dotnet/android#11709)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: David Ortinau <david.ortinau@microsoft.com>

* [release-notes] EF Core in .NET 11 Preview 6 (#10462)

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>

* [release-notes] F# in .NET 11 Preview 6 (#10461)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* [release-notes] Containers in .NET 11 Preview 6 (#10468)

* [release-notes] Containers in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update release notes

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Logan Bussell <loganbussell@microsoft.com>

* [release-notes] .NET Libraries in .NET 11 Preview 6 (#10457)

* [release-notes] .NET Libraries in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix async DataAnnotations sample after testing on the Preview 6 SDK

AsyncValidationAttribute is overridden via the protected IsValidAsync
(and IsValid) members, not GetValidationResultAsync (which is the public
method the framework calls and is not virtual). Verified the corrected
sample compiles and runs against the Preview 6 build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Verify Preview 6 library samples and fix inaccuracies

- Stream adapters: read from the read-only stream via StreamContent/PostAsync instead of copying HttpContent into it

- Cross-lane vectors: replace nonexistent Concat with ConcatLowerLower/LowerUpper/UpperLower/UpperUpper and drop preexisting Shuffle/ShuffleNative

- Async validation: swap the unique-username example for a VAT registry lookup, layer StringLength and RegularExpression sync rules with the async rule, and add a server-side validation note

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>

* [release-notes] ASP.NET Core in .NET 11 Preview 6 (#10456)

* [release-notes] WPF in .NET 11 Preview 6 (#10466)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Throw InvalidOperationException for sync validation of async validator

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Apply late review suggestions from #10456 to the ASP.NET Core notes

- OpenAPI unions: correct the third-party generator claim (ApiExplorer does not
  detect unions via JsonTypeInfoKind.Union; Swashbuckle/NSwag don't yet
  recognize unions). Per @DeagleGross review on #10456.
- Blazor Virtualize: note that a user scroll during ScrollToIndexAsync wins.
  Per @ilonatommy review on #10456.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add P6 Blazor items to align with docs (dotnet/AspNetCore.Docs#37322)

- CSRF: note that Blazor Web App templates no longer call app.UseAntiforgery().
- Bug fixes/Blazor: Virtualize is now CSP-compliant (#66680); session cookie is
  issued before streaming SSR for [SupplyParameterFromSession]/TempData (#66832).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Document 'Configure Blazor client behavior from the server' as a P6 feature

WithBrowserOptions flows client-side Blazor.start configuration from the server
in C# (log level, Server reconnection, SSR DOM preservation, WASM environment),
serialized to the client across Server/WebAssembly/Auto render modes. Introduced
in Preview 4 (server-to-browser config via DOM comment) and reshaped in Preview 6
(dotnet/aspnetcore#67337, proposal #66393). Includes the reshape/rename migration
for earlier adopters. Sample build-verified on 11.0.100-preview.6.26359.118.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Correct Virtualize CSP note: data-blazor-virtualize-reserved-height

Reviewing dotnet/AspNetCore.Docs#37322 surfaced that the attribute is
data-blazor-virtualize-reserved-height (only the server-computed spacer height),
not the generic data-blazor-style. Verified in the P6 source (Virtualize.cs /
Virtualize.ts). @ilonatommy corrected the same wording on the docs PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* [release-notes] .NET Runtime in .NET 11 Preview 6 (#10458)

* [release-notes] .NET Runtime in .NET 11 Preview 6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Enrich Preview 6 runtime notes with additional verified features

Fold verified .NET 11 Preview 6 runtime changes into runtime.md
(JIT improvements, in-process crash logging, NativeAOT interface
dispatch, SIMD lane APIs, and an expanded bug-fix list), and rebuild
the TOC to match the current sections.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ade796bb-8052-4946-b204-a88518267e77

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Rich Lander <2608468+richlander@users.noreply.github.com>

* fix markdown lint in preview6 containers note

Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
Co-authored-by: Chet Husk <chusk3@gmail.com>
Co-authored-by: Chet Husk <baronfel@users.noreply.github.com>
Co-authored-by: Klaus Löffelmann <9663150+KlausLoeffelmann@users.noreply.github.com>
Co-authored-by: David Ortinau <david.ortinau@microsoft.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: Logan Bussell <loganbussell@microsoft.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Rich Lander <2608468+richlander@users.noreply.github.com>
Co-authored-by: Rahul Bhandari <rbhanda@microsoft.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants