Build error using parallel test feature and text fixture name filter contains double quote
We are using TeamCity version 2025.11.1 (build 207998) and are using the parallel tests feature. We have a couple of TestFixtures that are using parameters, specifically a string parameter. When this TextFixture filter gets added to the runSettings file it escapes the paratheses and the double quotes. When the double quotes are escaped it causes an exception to be thrown:
05:53:17 Starting: .NET SDK 9.0.200 "C:\Program Files\dotnet\dotnet.exe" test C:\BuildAgent\work\920754e14e5d5953\NET\Bin\Release\ASC_X12Test.dll --settings C:\BuildAgent\temp\agentTmp\1.runsettings /logger:logger://teamcity /TestAdapterPath:C:\BuildAgent\plugins\dotnet\tools\vstest15 /logger:console;verbosity=normal
05:53:17 in directory: C:\BuildAgent\work\920754e14e5d5953
05:53:17 VSTest version 17.12.0 (x64)
05:53:17
05:53:17 Starting test execution, please wait...
05:53:17 TeamCity test logger version 1.0.42.314 is initialized
05:53:17 A total of 1 test files matched the specified pattern.
05:53:18 NUnit Adapter 6.0.0.0: Test execution started
05:53:18 An exception occurred while invoking executor 'executor://nunit3testexecutor/': Filter string 'OasisRulesTest.OASIS_DiagnosisConsistencyC212RulesTest\(\"OASIS 101 C1-102015 2.12 00T...\"\)' includes unrecognized escape sequence.
05:53:18 Stack trace:
05:53:18 at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Discovery.DiscoveryContext.GetTestCaseFilter(IEnumerable`1 supportedProperties, Func`2 propertyProvider) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryContext.cs:line 44
05:53:18 at NUnit.VisualStudio.TestAdapter.VsTestFilter.get_MsTestCaseFilterExpression() in C:\repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\VsTestFilter.cs:line 92
05:53:18 at NUnit.VisualStudio.TestAdapter.VsTestFilter.get_IsEmpty() in C:\repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\VsTestFilter.cs:line 94
05:53:18 at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.InitializeForExecution(IRunContext runContext, IFrameworkHandle frameworkHandle) in C:\repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 287
05:53:18 at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle) in C:\repos\nunit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 126
05:53:18 at Microsoft.VisualStudio.TestPlatform.Common.ExtensionDecorators.SerialTestRunDecorator.RunTests(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle) in /_/src/Microsoft.TestPlatform.Common/ExtensionDecorators/SerialTestRunDecorator.cs:line 59
05:53:18 at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithSources.InvokeExecutor(LazyExtension`2 executor, Tuple`2 executorUriExtensionTuple, RunContext runContext, IFrameworkHandle frameworkHandle) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithSources.cs:line 115
05:53:18 at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.<>c__DisplayClass46_0.<RunTestInternalWithExecutors>b__0() in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs:line 464
05:53:18 at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.<>c__DisplayClass0_0.<Run>b__0() in /_/src/Microsoft.TestPlatform.PlatformAbstractions/net462/System/PlatformThread.cs:line 29
05:53:18 --- End of stack trace from previous location where exception was thrown ---
05:53:18 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
05:53:18 at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(Action action, PlatformApartmentState apartmentState, Boolean waitForCompletion) in /_/src/Microsoft.TestPlatform.PlatformAbstractions/net462/System/PlatformThread.cs:line 47
05:53:18 at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.TryToRunInStaThread(Action action, Boolean waitForCompletion) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs:line 680
05:53:18 at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTestInternalWithExecutors(IEnumerable`1 executorUriExtensionMap, Int64 totalTests) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs:line 464
05:53:18
If the double quotes are not escaped then no exception is thrown. Are the double quotes in the runSettings file supposed to be escaped or not? What generates the contents of the runSettings file, is it TeamCity or one of the Test Adapters that does that?
Thanks,
Please sign in to leave a comment.
We have run experiments and if the double quotes are not escaped in the runSettings file then the filter works without any exception being thrown.