Skip to content

Property parsing splits up -p properties into more tokens and breaks dotnet test #50923

@nohwnd

Description

@nohwnd

Describe the bug

When testing vstest we provide a property that ends with .dll to point dotnet test to a locally built vstest.console.dll, after update to latest dotnet sdk the build now fails with:

The argument -p:VsTestConsolePath=S:\p\vstest\artifacts\tmp\Debug\extractedPackages\Microsoft.TestPlatform.CLI.18.0.0-dev.nupkg\contentFiles\any\net9.0\vstest.console.dll is invalid. Please use the /help option to check the list of valid arguments.

(in this arcade update: microsoft/vstest#15264 )

This is caused by this check in dotnet sdk, that is no longer false, so we end up calling vstest.console.exe directly, which is INCORRECT:

https://github.com/dotnet/sdk/blob/main/src/Cli/dotnet/Commands/Test/VSTest/TestCommand.cs#L50

The method checks for presence of any argument that ends with .dlll, but is not a property:

https://github.com/dotnet/sdk/blob/main/src/Cli/dotnet/Commands/Test/VSTest/TestCommand.cs#L299

which used to work because the parsed arguments looked like this:

Image

But after this PR and change look like this:

480b58f#diff-99e0f27176e2b38367e3898ec98c6d1a67f2cb629195156f4bc1c57b2ef6670bR30

Image

Meaning that we don't correctly detect that the .dll is part of msbuild property, and offload the work to vstest.console.exe directly.

To Reproduce

Run dotnet test -p:AAA=.dll on net10 rc1 and newer.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions