From e8d8290561542b8dea1dd782ac128f521ece8f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 19 Oct 2026 21:07:00 +0200 Subject: [PATCH] Extract the explicit-token tuple predicate Name the tuple-row check without changing its guards or short-circuit order. Keep the shared display-name token predicate introduced by #12021. Fixes #12017 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8589acf0-ae23-4d9e-9d8b-6d5bb09e85cd --- .../Helpers/TestDataSourceHelpers.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Helpers/TestDataSourceHelpers.cs b/src/Adapter/MSTestAdapter.PlatformServices/Helpers/TestDataSourceHelpers.cs index 63c6fc1ade..17053ed078 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Helpers/TestDataSourceHelpers.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Helpers/TestDataSourceHelpers.cs @@ -17,9 +17,7 @@ public static bool IsDataConsideredSingleArgumentValue(object?[]? data, Paramete && GetDataParameterCount(parameters) == 1 && parameters[0].ParameterType == typeof(object[]) && !IsDataWithExplicitCancellationToken(data, parameters) - && !(parameters.Length == 2 && data.Length == 1 - && TryHandleTupleDataSource(data[0], parameters, out object?[] tupleArguments) - && IsDataWithExplicitCancellationToken(tupleArguments, parameters)); + && !IsSingleTupleArgumentWithExplicitCancellationToken(data, parameters); public static bool TryHandleITestDataRow( object?[] d, @@ -95,6 +93,12 @@ public static bool TryHandleTupleDataSource(object? data, ParameterInfo[] testMe return true; } + // A tuple supplying the data argument and its token is a full row, not an object[] value to wrap. + private static bool IsSingleTupleArgumentWithExplicitCancellationToken(object?[] data, ParameterInfo[] parameters) + => parameters.Length == 2 && data.Length == 1 + && TryHandleTupleDataSource(data[0], parameters, out object?[] tupleArguments) + && IsDataWithExplicitCancellationToken(tupleArguments, parameters); + private static bool IsDataWithExplicitCancellationToken(object?[] data, ParameterInfo[] parameters) => TestDataSourceUtilities.IsDataWithExplicitCancellationToken(data, parameters);