Fix serialization issue with enum when building capabilities#14784
Merged
davidfowl merged 3 commits intomicrosoft:mainfrom Feb 28, 2026
Merged
Fix serialization issue with enum when building capabilities#14784davidfowl merged 3 commits intomicrosoft:mainfrom
davidfowl merged 3 commits intomicrosoft:mainfrom
Conversation
…aller and CapabilityDispatcher
…lityDispatcher tests
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14784Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14784" |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds JsonStringEnumConverter to the JSON serialization options used by ATS marshalling and capability dispatching to ensure enums can round-trip as strings (fixing enum deserialization failures like iconVariant).
Changes:
- Add
JsonStringEnumConvertertoCapabilityDispatcherJSON options for DTO parsing. - Add
JsonStringEnumConvertertoAtsMarshallerJSON options for DTO marshal/unmarshal. - Add unit tests covering enum string serialization/deserialization behaviors (including case-insensitive reads).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/Aspire.Hosting.RemoteHost.Tests/CapabilityDispatcherTests.cs | Adds GetDto tests validating enum properties deserialize from string values. |
| tests/Aspire.Hosting.RemoteHost.Tests/AtsMarshallerTests.cs | Adds tests asserting enum string converter is present and enums round-trip as strings. |
| src/Aspire.Hosting.RemoteHost/Ats/CapabilityDispatcher.cs | Configures dispatcher JSON options to include JsonStringEnumConverter. |
| src/Aspire.Hosting.RemoteHost/Ats/AtsMarshaller.cs | Configures marshaller JSON options to include JsonStringEnumConverter. |
…e AtsMarshaller.JsonOptions
davidfowl
approved these changes
Feb 28, 2026
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
Add
JsonStringEnumConverterto JSON serialization options inAtsMarshallerandCapabilityDispatcher.Contributes to #14772
Resolves this following error:
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: