Skip to content

Improve failure reporting when platform tools fail to start - #690

Merged
soujay merged 14 commits into
masterfrom
report-platform-tool-startup-failure-suggestions
Oct 26, 2026
Merged

soujay merged 14 commits into
masterfrom
report-platform-tool-startup-failure-suggestions

Conversation

@cquirosj

@cquirosj cquirosj commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Suggested follow-ups from the review, one per commit:

  • Non-zero exit code: sets Environment.ExitCode = 1 when a tool fails to start, so scripts and IDEs can detect it. It doesn't throw, because the samples don't catch exceptions from Launch().
  • Clearer failure message: includes the tool's exit code. If no error output was captured (for example when tool output is shown in the console), it points to the console output and the .logs folder instead of printing an empty line.
  • Ctrl+C during "Waiting for ServiceControl": handles the cancellation instead of crashing with an unhandled TaskCanceledException. This crash also happens on master.

Tested on macOS with a missing runtime (tool output hidden and shown), and with Ctrl+C both during the wait and after startup.

soujay and others added 12 commits October 19, 2026 20:10
This reverts commit 489f656.
When a tool fails to start, Launch() prints the error and returns
normally, so the launcher process still exits with code 0. A script, CI
job or IDE can't tell that startup failed.

Set Environment.ExitCode to 1 on that path. This doesn't throw, because
the samples call Launch() without a try/catch: an exception would add an
unhandled-exception stack trace on top of the error that was just
printed, without telling the user anything new.
The error output is only captured while the tool output is hidden. With
showPlatformToolConsoleOutput enabled, or when a tool exits without
writing to stderr, the launcher printed "<tool> failed to start:"
followed by an empty line.

Include the exit code in the message, and when nothing was captured,
point to the console output above and the .logs folder instead.
Pressing Ctrl+C (or cancelling the token passed to Launch()) during
"Waiting for ServiceControl to be available" crashed the launcher with
an unhandled TaskCanceledException, because WaitForHttpOk lets the
cancellation exception escape. This was already the case before this
PR, but the PR touches this block, so it's a cheap fix.

Catch OperationCanceledException when the launcher's token was
cancelled, the same way the "Press Ctrl+C" wait below already does, so
the launcher continues to the normal shutdown path.
Base automatically changed from report-platform-tool-startup-failure to master October 26, 2026 16:10
@soujay
soujay enabled auto-merge (squash) October 26, 2026 21:16
@soujay
soujay merged commit a21f10f into master Oct 26, 2026
4 checks passed
@soujay
soujay deleted the report-platform-tool-startup-failure-suggestions branch October 26, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants