You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VSTestBridge BuildFilter misclassifies a FullyQualifiedName that is a valid GUID as an Id= filter #9784
ContextAdapterBase.BuildFilter (in src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ContextAdapterBase.cs) uses a heuristic to decide whether a TestNodeUid should be turned into an Id=<guid> clause or a FullyQualifiedName=<name> clause:
The UID value comes from ObjectModelConverters.ToTestNode, which sets it to either testCase.FullyQualifiedName or testCase.Id.ToString() depending on useFullyQualifiedNameAsUid. When useFullyQualifiedNameAsUid is true, the UID is a FullyQualifiedName. If that FQN happens to be a string that Guid.TryParse accepts (e.g. a data-driven/parameterized test whose display name is exactly a GUID-shaped string), BuildFilter will incorrectly emit Id=<guid> instead of FullyQualifiedName=<value>, so the reconstructed TestCaseFilter selects by the wrong property and the intended test may not be selected/run.
This is a pre-existing latent issue, noticed during review of #9771 (which fixed a separate IndexOutOfRangeException in the same method). It is intentionally out of scope for that PR.
Have a VSTest-bridged adapter reporting nodes with useFullyQualifiedNameAsUid = true.
Produce a test whose FullyQualifiedName parses as a Guid (any of the formats Guid.TryParse accepts, e.g. 12345678-1234-1234-1234-1234567890ab).
Select that test by UID over the server protocol (e.g. run the single test from an IDE Test Explorer).
BuildFilter emits Id=<guid> instead of FullyQualifiedName=<name>.
Expected behavior
The clause type should reflect how the UID was produced (FullyQualifiedName vs Id), not a Guid.TryParse heuristic on the value — so a FQN that is coincidentally GUID-shaped is still emitted as FullyQualifiedName=....
Actual behavior
A GUID-shaped FullyQualifiedName is emitted as an Id=<guid> clause, potentially selecting the wrong test (or no test).
Additional context
Possible directions:
Carry the discriminator (FQN vs Id) explicitly through the TestNodeUid / filter pipeline instead of re-deriving it with Guid.TryParse in BuildFilter.
Or key the decision off the same useFullyQualifiedNameAsUid signal used when the UID was created.
Activity