Skip to content

Unclear error if executable working directory does not exist #18652

Description

@afscrome

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

If you try to run an executable with a bad working directory, you get an unclear error message. This can be particularly easy to do if you're trying to set a relative path to a working directoyr, and haven't counted the number of ..\ segments correctly.

[sys] Starting process...: Cmd = C:\Program Files\PowerShell\7\pwsh.exe, Args = []
 [sys] Failed to start a process: Cmd = C:\Program Files\PowerShell\7\pwsh.exe, Args = [], Error = fork/exec C:\Program Files\PowerShell\7\pwsh.exe: The directory name is invalid.
 [sys] An attempt to start the Executable failed: Error = fork/exec C:\Program Files\PowerShell\7\pwsh.exe: The directory name is invalid.
 [sys] The Executable failed to start: Error = all available Executable runners have been tried and failed
 [sys] No valid Executable run info could be found: Error = could not find starting run data after Executable start attempt

The error looks like it's complaining about the path of the executable (),

Expected Behavior

I'd expect a clear error message indicating

  1. That the working directory has the bad path
  2. The value of the working directory. (preferably with any relative paths resolved)

Steps To Reproduce

var exe = builder.AddExecutable("bad-working-dir", "pwsh", ".")
   .WithWorkingDirectory("s:\\does\\not\\exist");

Exceptions (if any)

No response

Aspire doctor output

Aspire Environment Check

Aspire
✅ Aspire CLI version 13.4.2 (channel: stable)

AppHost
✅ AppHost version 13.4.6 (src\dotnet\connector\aspire\AppHost\AppHost.csproj)

.NET SDK
✅ .NET 10.0.301 installed (x64)

Container Runtime
✅ Docker v29.6.1: running (auto-detected (default)) ← active

Environment
✅ HTTPS development certificate is trusted

Summary: 5 passed, 0 warnings, 0 failed

Aspire CLI Installations

╭──────────────────────────────────────────────────────┬─────────────────────────────────────────────────┬─────────┬───────────┬─────────────╮
│ Path │ Version │ Channel │ Route │ PATH status │
├──────────────────────────────────────────────────────┼─────────────────────────────────────────────────┼─────────┼───────────┼─────────────┤
│ C:\Users\alexanderc.aspire\bin\aspire.exe (current) │ 13.4.2+d7d0b6759ce4b936c76bc4775814d27db560dd6d │ stable │ (unknown) │ active

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions