Skip to content

Incorrect transformation of command line args with \ symbol on unix #15043

Description

@nvborisenko

On Windows the following command works good:

dotnet test -- NUnit.Where="namespace =~ /Abc\.Space1($|\.)/"

On Unix I use:

dotnet test -- NUnit.Where='namespace =~ /Abc\.Space1($|\.)/'

Error:

An exception occurred while invoking executor 'executor://nunit3testexecutor/': Unexpected token '.Space1($|' at position 18 in selection expression.

Gather diagnostics, and saw it:

TpTrace Information: 0 : 52885, 1, 2025/04/04, 17:51:29.669, 11794136606425, vstest.console.dll, TestRunRequest.ExecuteAsync: Starting run with settings:TestRunCriteria:
   KeepAlive=False,FrequencyOfRunStatsChangeEvent=10,RunStatsChangeEventTimeout=00:00:01.5000000,TestCaseFilter=,TestExecutorLauncher=
   Settingsxml=<RunSettings>
  <RunConfiguration>
    <ResultsDirectory>/mnt/e/Temp/Abc/TestResults</ResultsDirectory>
    <TargetPlatform>X64</TargetPlatform>
    <TargetFrameworkVersion>.NETCoreApp,Version=v8.0</TargetFrameworkVersion>
    <TestAdaptersPaths>/home/nick/.nuget/packages/coverlet.collector/6.0.4/build/netstandard2.0/</TestAdaptersPaths>
    <DesignMode>False</DesignMode>
    <CollectSourceInformation>False</CollectSourceInformation>
  </RunConfiguration>
  <NUnit>
    <Where>namespace =~ /Abc//.Space1($|//.)/</Where>
  </NUnit>
  <LoggerRunSettings>
    <Loggers>
      <Logger friendlyName="Console" uri="logger://microsoft/TestPlatform/ConsoleLogger/v1" assemblyQualifiedName="Microsoft.VisualStudio.TestPlatform.CommandLine.Internal.ConsoleLogger, vstest.console, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" codeBase="/usr/lib/dotnet/sdk/8.0.110/vstest.console.dll" enabled="True" />
    </Loggers>
  </LoggerRunSettings>
</RunSettings>

Please pay attention that my \ symbol is silently converted to //. It happens on Unix only.

Metadata

Metadata

Assignees

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions