Repository navigation
Accept whole-number ATS values for integral parameters - #15636
Conversation
Co-authored-by: Copilot <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15636Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15636" |
There was a problem hiding this comment.
Pull request overview
Updates the shared ATS marshaller so integral CLR parameters (e.g., int, long) can accept JSON number payloads that are whole numbers (including values represented as doubles like 11433.0), while still rejecting fractional numbers.
Changes:
- Added numeric parsing helpers (
ReadNumericValue/ReadIntegralNumericValue) and expanded integral-type handling inConvertPrimitive. - Added unit tests verifying whole-double →
int/longcoercion and fractional-double rejection forint.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Aspire.Hosting.RemoteHost/Ats/AtsMarshaller.cs | Adds numeric coercion logic for integral CLR types and refactors numeric primitive conversion. |
| tests/Aspire.Hosting.RemoteHost.Tests/AtsMarshallerTests.cs | Adds tests for whole-double integral conversion and fractional rejection. |
Co-authored-by: Copilot <[email protected]>
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Looks good overall — the coercion logic is correct and well-tested. Two minor nits inline, neither blocking.
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Good to go once comments addressed.
Co-authored-by: Copilot <[email protected]>
|
🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23632090148 |
* Accept whole-number ATS values for integral parameters Co-authored-by: Copilot <[email protected]> * Refine ATS numeric conversions Co-authored-by: Copilot <[email protected]> * Clarify ATS numeric safety checks Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
|
No documentation PR is required for this change. Reason: This is an internal bug fix that updates the ATS marshaller to coerce whole-number JSON values into integral CLR types (e.g.,
|
Description
This change updates the shared ATS marshaller to accept whole-number JSON values for integral CLR parameters.
Motivation/context:
Java playground AppHosts can currently pass integral values through the ATS
numberwire type, which caused runtimeTYPE_MISMATCHfailures when the server expected CLR integral types such asSystem.Int32. This change makes the marshaller coerce whole-number payloads into the requested integral CLR type while still rejecting fractional values for integral parameters.Validation:
./dotnet.sh test tests/Aspire.Hosting.RemoteHost.Tests/Aspire.Hosting.RemoteHost.Tests.csproj -- --filter-method "*.ConvertPrimitive_ConvertsIntFromWholeDouble" --filter-method "*.ConvertPrimitive_ThrowsForIntFromFractionalDouble" --filter-method "*.ConvertPrimitive_ConvertsLongFromWholeDouble" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"playground/polyglot/Java/Aspire.Hosting.SqlServer/ValidationAppHostwith the local CLI and confirmed the previouswithHostPorttype mismatch no longer occurs; execution now proceeds to a separate runtime issue.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: