[Dashboard] Reject numeric persistence mode values
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
`PostConfigureDashboardOptions` uses `Enum.TryParse` followed by `Enum.IsDefined`, so numeric strings that map to defined enum members are accepted.
For example, `--persistence 1` initializes the Dashboard in `Run` mode even though user-facing validation lists only `None`, `Run`, and `Resume`.
### Expected Behavior
Only the documented named values should be accepted.
### Steps To Reproduce
1. Run `aspire dashboard run --persistence 1`.
2. Inspect the Dashboard startup log.
3. The Dashboard initializes in `Run` mode instead of rejecting the value.
### Exceptions (if any)
N/A
### Aspire doctor output
```plain
Aspire CLI 13.6.0-pr.18924.g5ee63941
Windows 10.0.26200
```
### Anything else?
Related to #18924. Source: `src/Aspire.Dashboard/Configuration/PostConfigureDashboardOptions.cs:39-50`. The same behavior remains on current `main`.
Contributor guide
Research direction
Start in src/Aspire.Dashboard/Configuration/PostConfigureDashboardOptions.cs, especially lines 39-50, and reproduce the behavior with `aspire dashboard run --persistence 1`. Done means numeric strings are rejected while the documented named values None, Run, and Resume remain accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100