microsoft / microsoft/aspire

Unclear error if executable working directory does not exist

Open
#18,652 0 comments 0 reactions 1 assignee Claimed by @karolz-ms View on GitHub
area-orchestrator
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] 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

```cs
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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.