Repository navigation
Improve ordering of ITestSessionLifetimeHandler.OnTestSessionFinishingAsync - #7520
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts end-of-test-session behavior in Microsoft.Testing.Platform to reduce ordering-related issues between ITestSessionLifetimeHandler.OnTestSessionFinishingAsync implementations (notably producer vs consumer handlers), and simplifies MSBuild self-registered extension generation.
Changes:
- Update
CommonTestHost.NotifyTestSessionEndAsyncto invoke non-IDataConsumerlifetime handlers first, drain the message bus, then invokeIDataConsumerhandlers (draining between consumers). - Remove the MSBuild task logic that reorders self-registered extensions to force the TRX builder hook to the end, and generate code using the original item order.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/Platform/Microsoft.Testing.Platform/Hosts/CommonTestHost.cs |
Implements two-phase finishing notification ordering and additional drain points to improve producer/consumer interaction reliability. |
src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/TestingPlatformAutoRegisteredExtensions.cs |
Removes explicit TRX-last reordering when generating the self-registered extensions source. |
Amaury Levé (Evangelink)
left a comment
There was a problem hiding this comment.
It seems to me we are complexifying handling just for the sake of 1 extension without really providing a general feature that would be beneficial to all extensions.
|
It should be helping more than TRX. For example: This is a consumer lifetime handler, so it's delayed after non-consumers. This ensures that it will consume I think in most cases, the ordering problem is solved just by making non-consumers first, without any need for extension authors to have to think about ordering which is likely to be more messy (IMO). |
Amaury Levé (Evangelink)
left a comment
There was a problem hiding this comment.
Alright, let's see :)
No description provided.