Repository navigation
Reject numeric persistence mode values in dashboard configuration - #19966
Muhammad Bilal (MuhammadBilal64) wants to merge 5 commits into
Conversation
Fixes microsoft#19781 `Enum.TryParse` accepts numeric strings that map to defined enum values, so `--persistence 1` silently succeeded as `Run` even though only named values (None, Run, Resume) are documented. Added a check to reject numeric input before parsing, plus a regression test.
Fixes microsoft#19781 `Enum.TryParse` accepts numeric strings that map to defined enum values, so `--persistence 1` silently succeeded as `Run` even though only named values (None, Run, Resume) are documented. Added a check to reject numeric input before parsing, plus a regression test.
…om/MuhammadBilal64/aspire into fix-persistence-numeric-validation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19966Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19966" |
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
🟢 Approval recommended
The focused validation change correctly addresses the reported issue and includes appropriate regression coverage.
Pull request overview
Rejects numeric dashboard persistence modes while preserving named values.
Changes:
- Rejects numeric values before enum parsing.
- Adds regression coverage for
--persistence 1.
File summaries
| File | Description |
|---|---|
src/Aspire.Dashboard/Configuration/PostConfigureDashboardOptions.cs |
Rejects numeric persistence modes. |
tests/Aspire.Dashboard.Tests/DashboardOptionsTests.cs |
Verifies numeric input produces a validation error. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Hi James Newton-King (@JamesNK) Adam Ratzman (@adamint), gentle reminder on this PR when you get a chance. Would appreciate a review. Thanks! |
|
Hi James Newton-King (@JamesNK) Adam Ratzman (@adamint), following up on this PR since it’s still awaiting a maintainer review. Copilot’s review found no issues and recommended approval. When you get a chance, could you please take a look? Thanks! |
Description
PostConfigureDashboardOptionsusesEnum.TryParsefollowed byEnum.IsDefinedto validate the--persistencevalue.Enum.TryParseaccepts numeric strings that map to defined enum values, so--persistence 1silently succeeded and initialized the Dashboard inRunmode, even though only the named valuesNone,Run, andResumeare documented as valid.This adds a check to reject numeric input before attempting the enum parse, so numeric values are now correctly rejected with the existing parse-error message. Added a regression test covering this case.
Fixes #19781
Checklist
<remarks />and<code />elements on your triple slash comments?