Skip to content

Always display message when no app host, share common resource strings#14661

Merged
JamesNK merged 2 commits intorelease/13.2from
jamesnk/cli-no-apphost-messages
Feb 25, 2026
Merged

Always display message when no app host, share common resource strings#14661
JamesNK merged 2 commits intorelease/13.2from
jamesnk/cli-no-apphost-messages

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented Feb 24, 2026

Description

There are some commands, e.g. aspire logs, where nothing is displayed if there is no app host. CLI exits with success status code and no output. Confusing.

PR changes:

  • Always display a message if no app host is found.
  • Adds a shared resource file and makes text used when resolving a connection consistent. Removes inconsistency and duplication around app host connection messages displayed.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings February 24, 2026 23:01
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 24, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14661

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14661"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request consolidates duplicate resource strings across CLI commands into a new shared resource file (SharedCommandStrings) and ensures that all commands display consistent messages when no AppHost is found. The changes improve code maintainability by removing duplication and enhance user experience by consistently showing error messages.

Changes:

  • Created new SharedCommandStrings.resx resource file with common strings used across multiple commands
  • Migrated shared strings (ScanningForRunningAppHosts, SelectAppHost, NoInScopeAppHostsShowingAll, AppHostNotRunning, ProjectOptionDescription) from individual command resource files to the shared file
  • Updated SelectAppHost to use format string with {0} placeholder to support different action verbs per command
  • Added [MemberNotNullWhen(false, nameof(ErrorMessage))] attribute to ensure ErrorMessage is always set when Success is false
  • Modified all commands to display error messages instead of silently returning when no AppHost is found

Reviewed changes

Copilot reviewed 121 out of 129 changed files in this pull request and generated no comments.

Show a summary per file
File Description
SharedCommandStrings.resx New shared resource file containing common AppHost-related strings
SharedCommandStrings.Designer.cs Auto-generated designer file for shared resources
SharedCommandStrings.*.xlf Localization files for shared strings (all languages, marked as "new")
*CommandStrings.resx Removed duplicate strings, added command-specific SelectAppHostAction
*Command.cs Updated to use SharedCommandStrings and display errors consistently
AppHostConnectionResolver.cs Added MemberNotNullWhen attribute for ErrorMessage
Files not reviewed (8)
  • src/Aspire.Cli/Resources/DescribeCommandStrings.Designer.cs: Language not supported
  • src/Aspire.Cli/Resources/LogsCommandStrings.Designer.cs: Language not supported
  • src/Aspire.Cli/Resources/PsCommandStrings.Designer.cs: Language not supported
  • src/Aspire.Cli/Resources/ResourceCommandStrings.Designer.cs: Language not supported
  • src/Aspire.Cli/Resources/SharedCommandStrings.Designer.cs: Language not supported
  • src/Aspire.Cli/Resources/StopCommandStrings.Designer.cs: Language not supported
  • src/Aspire.Cli/Resources/TelemetryCommandStrings.Designer.cs: Language not supported
  • src/Aspire.Cli/Resources/WaitCommandStrings.Designer.cs: Language not supported

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 24, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit e6070e0:

Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AgentInitCommand_WithMalformedMcpJson_ShowsErrorAndExitsNonZero ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording

📹 Recordings uploaded automatically from CI run #22375410710

@JamesNK JamesNK enabled auto-merge (squash) February 25, 2026 01:04
@JamesNK JamesNK merged commit eb58e52 into release/13.2 Feb 25, 2026
676 of 679 checks passed
@JamesNK JamesNK deleted the jamesnk/cli-no-apphost-messages branch February 25, 2026 01:13
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Feb 25, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants