Skip to content

Drop MSBuild extension's dependency on internal TestRequestExecutionTimeInfo#8514

Merged
Evangelink merged 2 commits into
mainfrom
dev/amauryleve/msbuild-drop-execution-time-info
May 23, 2026
Merged

Drop MSBuild extension's dependency on internal TestRequestExecutionTimeInfo#8514
Evangelink merged 2 commits into
mainfrom
dev/amauryleve/msbuild-drop-execution-time-info

Conversation

@Evangelink
Copy link
Copy Markdown
Member

What

The MSBuild extension (Microsoft.Testing.Extensions.MSBuild) no longer
depends on the internal TestRequestExecutionTimeInfo message from
Microsoft.Testing.Platform. MSBuildConsumer now measures session
duration with a local Stopwatch started in OnTestSessionStartingAsync
and stopped in OnTestSessionFinishingAsync (where the
RunSummaryInfoRequest is now sent).

Because that internal message had no other consumer (DotnetTestDataConsumer
listed it in DataTypesConsumed but never actually handled it in its
ConsumeAsync switch), this PR also:

  • removes TestRequestExecutionTimeInfo.cs entirely;
  • drops the IDataProducer implementation (DataTypesProduced + the
    messageBus.PublishAsync call) from TestHostTestFrameworkInvoker;
  • removes the dead typeof(TestRequestExecutionTimeInfo) entry from
    DotnetTestDataConsumer.DataTypesConsumed.

Why

Tracked by #8437 ("MSBuild extension still depends on internal
TestRequestExecutionTimeInfo"), which itself was a blocker noted in
#7739 for letting the MSBuild extension drop IVT on
Microsoft.Testing.Platform.

Behavior change

The duration reported in the MSBuild summary line is now measured from the
start of MSBuildConsumer.OnTestSessionStartingAsync to the end of its
OnTestSessionFinishingAsync, instead of just the
CreateTestSessionAsyncCloseTestSessionAsync window previously
measured by TestHostTestFrameworkInvoker. In practice this difference is
typically negligible and arguably more representative of what users perceive
as the test run duration.

Test

  • MSTest.Acceptance.IntegrationTests and
    Microsoft.Testing.Platform.Acceptance.IntegrationTests -- all targeted
    InvokeTestingPlatform_Target_Should* cases pass (12/12 single-TFM,
    32/32 with multi-TFM).
  • New regression assertion in MSBuildTests.Test.cs checks the summary
    line still contains a non-empty Duration: ... value.
  • Full unit-test suite passes locally.

Fixes #8437

…imeInfo

MSBuildConsumer now measures session duration with a local Stopwatch started in OnTestSessionStartingAsync and stopped in OnTestSessionFinishingAsync, where the RunSummaryInfoRequest is now sent. This removes the only consumer of the internal Microsoft.Testing.Platform.TestRequestExecutionTimeInfo message, so the type and its producer (TestHostTestFrameworkInvoker.IDataProducer implementation) are removed as well. DotnetTestDataConsumer also drops the type from DataTypesConsumed where it was listed but never handled.

The new duration is slightly broader: it includes the session-lifetime start/finish callbacks instead of only the framework's ExecuteAsync window. For typical runs this difference is negligible and arguably more representative of what users perceive as the test run duration.

Adds a regression assertion in MSBuildTests.Test.cs verifying that the MSBuild summary line still emits a non-empty Duration value.

Fixes #8437

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 22, 2026 16:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 removes the MSBuild extension’s dependency on the internal TestRequestExecutionTimeInfo message by switching MSBuildConsumer to measure session duration locally (Stopwatch) and then cleaning up the now-dead message type and its unused producer/consumer wiring inside Microsoft.Testing.Platform.

Changes:

  • Replaces TestRequestExecutionTimeInfo consumption in MSBuildConsumer with a session-scoped Stopwatch and sends the run summary at OnTestSessionFinishingAsync.
  • Removes the internal message type (TestRequestExecutionTimeInfo.cs) and stops producing it from TestHostTestFrameworkInvoker.
  • Cleans up DotnetTestDataConsumer’s DataTypesConsumed and adds an acceptance regression assertion ensuring a non-empty Duration: is still reported.
Show a summary per file
File Description
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs Adds regression assertion that MSBuild summary output still includes a non-empty Duration.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.cs Removes dead consumed data type entry for the deleted timing message.
src/Platform/Microsoft.Testing.Platform/Requests/TestHostTestFrameworkInvoker.cs Stops producing/publishing the internal timing message and drops IDataProducer implementation.
src/Platform/Microsoft.Testing.Platform/Messages/TestRequestExecutionTimeInfo.cs Deletes the internal timing message type that no longer has consumers.
src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs Implements local session timing (Stopwatch) and emits run summary during session finishing.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 1

Comment thread src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink merged commit 34182f7 into main May 23, 2026
51 checks passed
@Evangelink Evangelink deleted the dev/amauryleve/msbuild-drop-execution-time-info branch May 23, 2026 15:44
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.

[MTP Integration Analysis] MSBuild extension still depends on internal TestRequestExecutionTimeInfo

2 participants