Skip to content

ArgumentStringHandler bug #1495

@Roadrunner67

Description

@Roadrunner67

Usage Information

9.0.3 / 8.0.11 / net8 / Windows 11

Description

If you declare a tool that takes a directory as its only argument and that directory contains spaces, ArgumentStringHandler will not quote the path.

Reproduction Steps

Add this test to ArgumentStringHandlerTest:

    [Fact]
    public void TestSpacedPathOnly()
    {
        ArgsToString($"{"C:/Program Files"}").Should().Be("\"C:/Program Files\"");
    }

Expected Behavior

string path = "C:/Program Files";
MyTool($"{path}");
should call:
path_to_tool/MyTool.exe "C:/Program Files"

Actual Behavior

no quotes:
path_to_tool/MyTool.exe C:/Program Files

Regression?

7.0.2 on net6 did not do this

Known Workarounds

Adding a space at the end seems to help:
MyTool($"{path} ");

Could you help with a pull-request?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions