Fix misleading "no longer running" state detail when container fails to start#16747
Open
Fix misleading "no longer running" state detail when container fails to start#16747
Conversation
Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/7da09e5e-85ab-4857-872e-38ebb998e3ce Co-authored-by: karolz-ms <15271049+karolz-ms@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix misleading state detail for container failure
Fix misleading "no longer running" state detail when container fails to start
May 4, 2026
karolz-ms
reviewed
May 4, 2026
| if (resource.IsStopped()) | ||
| if (resource.IsFailedToStart()) | ||
| { | ||
| // Resource failed to start. It was never running, so "no longer running" would be misleading. |
Contributor
There was a problem hiding this comment.
@copilot get rid of this comment, it is not necessary
Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/8f9ab161-eaa7-4b3d-8901-271f6ee233a0 Co-authored-by: karolz-ms <15271049+karolz-ms@users.noreply.github.com>
karolz-ms
approved these changes
May 4, 2026
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16747Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16747" |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an incorrect/misleading “State details” tooltip for resources in FailedToStart by adding a dedicated localized message path, instead of falling through to the generic “no longer running” message intended for previously-running resources.
Changes:
- Adds a
ResourceViewModel.IsFailedToStart()extension and prioritizes it inResourceStateViewModel.GetResourceStateTooltip(...). - Introduces a new localized string
StateColumnResourceFailedToStart("{0} failed to start") and updates XLF translation stubs. - Extends dashboard unit tests to assert the new tooltip behavior for
FailedToStart.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Dashboard.Tests/Model/ResourceStateViewModelTests.cs | Adds coverage ensuring FailedToStart uses the new dedicated tooltip string. |
| src/Aspire.Dashboard/Model/ResourceStateViewModel.cs | Updates tooltip selection logic to handle FailedToStart explicitly before the generic stopped path. |
| src/Aspire.Dashboard/Extensions/ResourceViewModelExtensions.cs | Adds IsFailedToStart() convenience extension for state checks. |
| src/Aspire.Dashboard/Resources/Columns.resx | Adds StateColumnResourceFailedToStart localized string. |
| src/Aspire.Dashboard/Resources/Columns.Designer.cs | Regenerates strongly-typed accessor for the new resource string. |
| src/Aspire.Dashboard/Resources/xlf/Columns.cs.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.de.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.es.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.fr.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.it.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.ja.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.ko.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.pl.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.pt-BR.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.ru.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.tr.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hans.xlf | Adds XLF entry for the new string (stub). |
| src/Aspire.Dashboard/Resources/xlf/Columns.zh-Hant.xlf | Adds XLF entry for the new string (stub). |
Files not reviewed (1)
- src/Aspire.Dashboard/Resources/Columns.Designer.cs: Language not supported
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resources in
FailedToStartstate showed "Container is no longer running" as the state detail — misleading because the resource never ran. This adds a dedicated state detail path forFailedToStartresources.Root cause:
IsStopped()includesFailedToStart, soGetResourceStateTooltipfell through to the genericStateColumnResourceExitedbranch ({0} is no longer running).Changes:
ResourceViewModelExtensions— AddedIsFailedToStart()extension method (KnownState is KnownResourceState.FailedToStart)ResourceStateViewModel.GetResourceStateTooltip— CheckIsFailedToStart()beforeIsStopped(); return newStateColumnResourceFailedToStartstring ({0} failed to start) for this caseColumns.resx/Columns.Designer.cs— New resource stringStateColumnResourceFailedToStart = "{0} failed to start"dotnet build /t:UpdateXlfResourceStateViewModelTests— Two new[InlineData]cases assertingFailedToStartresolves toStateColumnResourceFailedToStart, notStateColumnResourceExitedIsStopped()still includesFailedToStart(icon/command behavior is unaffected); only the tooltip/state-detail text is changed.Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue:Original prompt
Fix microsoft/aspire issue #16617:
[13.3] Misleading State Detail when container fails to start.Problem
In the Aspire dashboard resource details view, a container/resource with state
Failed to Startcurrently shows the state detail textContainer is no longer running. This is misleading because the resource failed to start; it was not previously running.The current flow is:
ResourceDetails.AddStateDescriptionProperty(...)adds a syntheticState detailsproperty whose value comes fromResourceStateViewModel.GetResourceStateTooltip(resource, ColumnsLoc).ResourceStateViewModel.GetResourceStateTooltip(...)first checksresource.IsStopped().ResourceViewModelExtensions.IsStopped()currently returns true forKnownResourceState.Exited,KnownResourceState.Finished, andKnownResourceState.FailedToStart.KnownResourceState.FailedToStartfalls into the generic stopped/exited branch and usesColumns.StateColumnResourceExited({0} is no longer running).Relevant current code:
Requested fix
Implement a separate state-detail text path for resources that failed to start.
Suggested approach:
src/Aspire.Dashboard/Extensions/ResourceViewModelExtensions.cs, for example:Update
ResourceStateViewModel.GetResourceStateTooltip(...)soFailedToStartgets its own localized message instead of usingStateColumnResourceExited.resource.IsFailedToStart()beforeresource.IsStopped().src/Aspire.Dashboard/Resources/Columns.resx, e.g.StateColumnResourceFailedToStart.{0} failed to startorResource failed to start; prefer consistency with existing state details that include resource type, so{0} failed to startis likely appropriate.Consider whether
IsStopped()should continue to includeFailedToStartfor icon/state command behavior. The requested behavior is specifically about the state detail text, so avoid broad behavior changes unless tests indicate it is necessary.Update/add tests in
tests/Aspire.Dashboard.Tests/Model/ResourceStateViewModelTests.csto coverKnownResourceState.FailedToStartand assert that the tooltip/state detail no longer resolves toStateColumnResourceExited/{0} is no longer running, but instead resolves to the new failed-to-start resource string.Follow repository conventions:
*/api/*.cs.global.json,NuGet.config,package.json, or lock files..editorconfig.Validation
Run the relevant dashboard tests, especially
tests/Aspire.Dashboard.Tests/Model/ResourceStateViewModelTests.csif feasible. At minimum, ensure the new test passes and existing resource state tooltip tests continue to pass.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: What is the source of "State details" content in the Aspire dashboard? Point me to the code that sets it
Assistant: The “State details” value in the Aspire dashboard is generated in
ResourceDetails.AddStateDescriptionProperty(...). It uses the same text as the resource grid state-column tooltip:ResourceStateViewModel.GetResourceStateTooltip(...).Key path:
resource-state-descriptionState detailsResourceStateViewModel.GetResourceStateTooltip(resource, ColumnsLoc)