Prevent UITestMethod false failures when test invocation hops execution context - #7746
Closed
Evangelink with Copilot wants to merge 3 commits into
Closed
Prevent UITestMethod false failures when test invocation hops execution context#7746Evangelink with Copilot wants to merge 3 commits into
Evangelink with Copilot wants to merge 3 commits into
Conversation
Closed
Agent-Logs-Url: https://github.com/microsoft/testfx/sessions/11e59258-9cb8-4e9d-83af-4502bd759f1c Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/testfx/sessions/11e59258-9cb8-4e9d-83af-4502bd759f1c Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix UITestMethod failure issue in test execution
Prevent UITestMethod false failures when test invocation hops execution context
Apr 17, 2026
Member
|
Based on Copilot investigation, here is a possibly simpler fix: #7749 |
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.
UITestMethodcould report failures even when UI assertions succeeded becauseTestMethodInfo.TestContextrelied onTestContext.Current, which can be lost when attributes invokeITestMethod.InvokeAsyncon dispatcher/unsafe-thread paths. This manifested asApplicationStateGuard.Unreachable()fromTestMethodInfoduring UI test execution.Execution path fix (adapter)
ITestMethodwrapper inTestMethodRunner.ExecuteAsyncnow passes this wrapper toExecutor.ExecuteAsync(...)instead of passingTestMethodInfodirectly.TestContextat the exactInvokeAsynccall site, so attribute-driven cross-thread execution still resolves test context correctly.Regression coverage
TestMethodRunnerTeststhat simulates execution-context loss viaThreadPool.UnsafeQueueUserWorkItem.TestMethodAttributethat invokesITestMethod.InvokeAsyncfrom that unsafe thread path and verifies the run completes asPassed.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
c50vsblobprodcus330.vsblob.vsassets.io/usr/bin/dotnet dotnet build test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestAdapter.PlatformServices.UnitTests.csproj -v minimal(dns block)/usr/bin/dotnet dotnet restore test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestAdapter.PlatformServices.UnitTests.csproj -v minimal(dns block)jd4vsblobprodcus366.vsblob.vsassets.io/usr/bin/dotnet dotnet build test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestAdapter.PlatformServices.UnitTests.csproj -v minimal(dns block)/usr/bin/dotnet dotnet restore test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestAdapter.PlatformServices.UnitTests.csproj -v minimal(dns block)If you need me to access, download, or install something from one of these locations, you can either: