microsoft / microsoft/aspire

Aspire CLI fails to match running AppHost on Windows when `--apphost` uses lowercase drive letter

Open
#16,278 4 comments 0 reactions 0 assignees View on GitHub
area-cli
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Summary

On Windows, `aspire resource restart --apphost ` fails to find a running AppHost if the supplied `--apphost` path uses a lowercase drive letter, even though the same path with an uppercase drive letter succeeds.

This appears to be a Windows path case-normalization bug when the CLI matches the supplied `--apphost` value to the running AppHost.

## Environment

- OS: Windows
- Repo layout: standard repo root with `.aspire/settings.json`
- AppHost path: `src\\Exceptionless.AppHost\\Exceptionless.AppHost.csproj`
- Working directory: repo root

Root settings file:

```json
{
"appHostPath": "../src/Exceptionless.AppHost/Exceptionless.AppHost.csproj"
}
```

## Repro

From the repo root, with the AppHost already running:

### Fails with lowercase drive letter

```powershell
aspire resource "Web-wzrpswpc" restart --apphost "c:\Users\eric\Projects\Exceptionless\Exceptionless\src\Exceptionless.AppHost\Exceptionless.AppHost.csproj" --non-interactive
```

Output:

```text
❌ No running apphost found. Use 'aspire run' to start one first.
```

### Succeeds with uppercase drive letter

```powershell
aspire resource "Web-wzrpswpc" restart --apphost "C:\Users\eric\Projects\Exceptionless\Exceptionless\src\Exceptionless.AppHost\Exceptionless.AppHost.csproj" --non-interactive
```

Output:

```text
✔ Resource 'Web-wzrpswpc' restarted successfully.
```

### Also succeeds with a relative path

```powershell
aspire resource "Web-wzrpswpc" restart --apphost "src\Exceptionless.AppHost\Exceptionless.AppHost.csproj"
```

Output:

```text
✔ Resource 'Web-wzrpswpc' restarted successfully.
```

## Additional details

The running AppHost is detected as:

```text
C:\Users\eric\Projects\Exceptionless\Exceptionless\src\Exceptionless.AppHost\Exceptionless.AppHost.csproj
```

So the CLI appears to be matching the provided `--apphost` path case-sensitively on Windows, even though Windows paths are case-insensitive.

## Expected behavior

The CLI should normalize Windows paths before comparing them, so `c:\...` and `C:\...` are treated as the same AppHost path.

## Actual behavior

If `--apphost` uses a lowercase drive letter, the CLI reports that no running AppHost exists.

## Why this matters

This can make tooling flaky if it emits `c:\...` instead of `C:\...`, even though the AppHost is already running and otherwise discoverable.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `aspire resource restart --apphost ` on Windows with lowercase and uppercase drive letters, then trace the AppHost matching path. Done means equivalent Windows paths locate the running AppHost, while the existing relative-path behavior continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.