Always display message when no app host, share common resource strings#14661
Always display message when no app host, share common resource strings#14661JamesNK merged 2 commits intorelease/13.2from
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14661Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14661" |
There was a problem hiding this comment.
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.resxresource 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
SelectAppHostto 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
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22375410710 |
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:
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: