Skip to content

aspire stop --all can fail after AppHost processes exit during termination monitoring #17662

@davidfowl

Description

@davidfowl

Summary

aspire stop --all can report successful stops for multiple AppHosts and then exit with an unexpected error while monitoring process termination.

Environment

  • Aspire CLI version: 13.4.0+3f0998a95833d5fef96b3159d56b667889b71166
  • Aspire CLI build ID: 13.400.26.27718
  • OS: macOS
  • Command: aspire stop --all

What happened

The command found six running AppHosts, sent stop signals, and printed several successful stop messages. It then failed with exit code 1.

Relevant log excerpt:

[2026-05-29 14:39:34.276] [DBUG] [StopCommand] Found 6 running AppHost(s) to stop
...
[2026-05-29 14:39:34.531] [INFO] [Stdout] ✅ FoundryAgents.AppHost.csproj stopped successfully.
[2026-05-29 14:39:34.531] [INFO] [Stdout] ✅ Aspire.Dev.AppHost.csproj stopped successfully.
[2026-05-29 14:39:34.531] [INFO] [Stdout] ✅ davidfowl-glowing-guide/pr-timeline-app.AppHost/pr-timeline-app.AppHost.csproj stopped successfully.
[2026-05-29 14:39:34.532] [INFO] [Stdout] ✅ davidfowl-cautious-goggles/pr-timeline-app.AppHost/pr-timeline-app.AppHost.csproj stopped successfully.
[2026-05-29 14:39:34.533] [INFO] [Stdout] ✅ davidfowl-bookish-umbrella/pr-timeline-app.AppHost/pr-timeline-app.AppHost.csproj stopped successfully.
[2026-05-29 14:39:34.534] [FAIL] [AspireCliTelemetry] An unexpected error occurred: Unable to retrieve the specified information about the process or thread.  It may have exited or may be privileged.
System.ComponentModel.Win32Exception (3): Unable to retrieve the specified information about the process or thread.  It may have exited or may be privileged.
   at System.Diagnostics.Process.get_StartTimeCore() + 0xf4
   at System.Diagnostics.Process.get_StartTime() + 0x20
   at ProcessSignaler.TryGetRunningProcess(Int32, Nullable`1, ILogger) + 0x5c
   at Aspire.Cli.Processes.ProcessShutdownService.IsProcessStopped(ProcessShutdownService.ProcessTarget) + 0x20
   at System.Linq.Enumerable.All[TSource](IEnumerable`1, Func`2) + 0x134
   at Aspire.Cli.Processes.ProcessShutdownService.<MonitorProcessesForTerminationAsync>d__17.MoveNext() + 0xe8
--- End of stack trace from previous location ---
   at Aspire.Cli.Processes.ProcessShutdownService.<StopProcessesAsync>d__11.MoveNext() + 0x104
--- End of stack trace from previous location ---
   at Aspire.Cli.Processes.ProcessShutdownService.<StopAppHostAsync>d__10.MoveNext() + 0xc8
--- End of stack trace from previous location ---
   at Aspire.Cli.Commands.StopCommand.<>c__DisplayClass17_0.<<StopAppHostAsync>b__0>d.MoveNext() + 0x70
--- End of stack trace from previous location ---
   at Aspire.Cli.Interaction.ConsoleInteractionService.<ShowStatusAsync>d__28`1.MoveNext() + 0x78
--- End of stack trace from previous location ---
   at Aspire.Cli.Commands.StopCommand.<StopAppHostAsync>d__17.MoveNext() + 0x130
--- End of stack trace from previous location ---
   at Aspire.Cli.Commands.StopCommand.<StopAllAppHostsAsync>d__16.MoveNext() + 0x160
--- End of stack trace from previous location ---
   at Aspire.Cli.Commands.StopCommand.<ExecuteAsync>d__13.MoveNext() + 0x220
--- End of stack trace from previous location ---
   at Aspire.Cli.Commands.BaseCommand.<>c__DisplayClass15_0.<<-ctor>b__0>d.MoveNext() + 0xc0
[2026-05-29 14:39:34.539] [INFO] [Stderr] ❌ An unexpected error occurred: Unable to retrieve the specified information about the process or thread.  It may have exited or may be privileged.
[2026-05-29 14:39:34.540] [INFO] [Cli] Exit code: 1

Expected behavior

If a process exits while aspire stop --all is monitoring termination, the CLI should treat that as stopped instead of surfacing a Win32Exception from Process.StartTime and failing the command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions