Drop MSBuild extension's dependency on internal TestRequestExecutionTimeInfo#8514
Merged
Evangelink merged 2 commits intoMay 23, 2026
Merged
Conversation
…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>
Contributor
There was a problem hiding this comment.
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
TestRequestExecutionTimeInfoconsumption inMSBuildConsumerwith a session-scoped Stopwatch and sends the run summary atOnTestSessionFinishingAsync. - Removes the internal message type (
TestRequestExecutionTimeInfo.cs) and stops producing it fromTestHostTestFrameworkInvoker. - Cleans up
DotnetTestDataConsumer’sDataTypesConsumedand adds an acceptance regression assertion ensuring a non-emptyDuration: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
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The MSBuild extension (Microsoft.Testing.Extensions.MSBuild) no longer
depends on the internal
TestRequestExecutionTimeInfomessage fromMicrosoft.Testing.Platform.MSBuildConsumernow measures sessionduration with a local Stopwatch started in
OnTestSessionStartingAsyncand stopped in
OnTestSessionFinishingAsync(where theRunSummaryInfoRequestis now sent).Because that internal message had no other consumer (
DotnetTestDataConsumerlisted it in
DataTypesConsumedbut never actually handled it in itsConsumeAsyncswitch), this PR also:TestRequestExecutionTimeInfo.csentirely;IDataProducerimplementation (DataTypesProduced+ themessageBus.PublishAsynccall) fromTestHostTestFrameworkInvoker;typeof(TestRequestExecutionTimeInfo)entry fromDotnetTestDataConsumer.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.OnTestSessionStartingAsyncto the end of itsOnTestSessionFinishingAsync, instead of just theCreateTestSessionAsync→CloseTestSessionAsyncwindow previouslymeasured by
TestHostTestFrameworkInvoker. In practice this difference istypically negligible and arguably more representative of what users perceive
as the test run duration.
Test
MSTest.Acceptance.IntegrationTestsandMicrosoft.Testing.Platform.Acceptance.IntegrationTests-- all targetedInvokeTestingPlatform_Target_Should*cases pass (12/12 single-TFM,32/32 with multi-TFM).
MSBuildTests.Test.cschecks the summaryline still contains a non-empty
Duration: ...value.Fixes #8437