Repository navigation
Fix Radius container image exports for TypeScript - #21830
Karol Zadora-Przylecki (karolz-ms) wants to merge 1 commit into
Conversation
Consolidate Radius container image exports on the shared .NET program overload while preserving the existing capability ID and concrete fluent APIs. Add generated SDK and runtime dispatch regression coverage. Fixes #21803 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21830Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21830" |
Tests selector4 / 101 PR test projects · 1 PR job, from 8 changed files. Selected PR test projects (4 / 101)
Selected PR jobs (1)
How these were chosen — grouped by what changed📦 affected project 🔧 🔧 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the restoration of withContainerImage(image) support in generated TypeScript AppHosts.
No open issues 🎉
What changed in this PR
Restores Radius’s withContainerImage(image) method for modern .NET projects in generated TypeScript AppHosts, addressing #21803 without changing the public C# overloads or scanner collision policy.
Changes:
- Exports the generic overload under the existing
withContainerImagecapability ID and excludes the legacy overload from discovery. - Adds scanning, TypeScript generation, and runtime-dispatch regressions covering legacy projects, file-based apps, and modern .NET projects.
- Records the intentional metadata return-type generalization in a scoped compatibility suppression. SDKs using the retired preview capability ID must be regenerated.
| File | Description |
|---|---|
tests/Aspire.Hosting.RemoteHost.Tests/CapabilityDispatcherTests.cs |
Tests dispatch, builder identity, and image replacement for all three resource types. |
tests/Aspire.Hosting.RemoteHost.Tests/Aspire.Hosting.RemoteHost.Tests.csproj |
Adds Dotnet and Radius references for dispatch tests. |
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsTypeScriptCodeGeneratorTests.Generate_RadiusWithContainerImage_PreservesConcreteFluentMethods_includeDotnet=True.verified.ts |
Captures concrete fluent methods and dispatch calls with Dotnet included. |
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsTypeScriptCodeGeneratorTests.Generate_RadiusWithContainerImage_PreservesConcreteFluentMethods_includeDotnet=False.verified.ts |
Captures legacy and file-based app methods without Dotnet. |
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs |
Verifies real-assembly scanning and generated fluent methods. |
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj |
Adds the Radius reference for generation tests. |
src/Aspire.Hosting.Radius/RadiusExtensions.cs |
Consolidates exports on the generic overload and clarifies image documentation. |
src/Aspire.Hosting.Radius/api/Aspire.Hosting.Radius.tscompat.suppression.txt |
Documents the intentional capability return-type compatibility exception. |
Review effort: Balanced
Description
Restores Radius's
withContainerImage(image)method onDotnetProjectResourcein generated TypeScript AppHosts. Overlapping legacy and generic exports previously caused a collision onCSharpAppResourcethat removed the generic capability for every target, including modern .NET projects.Export the generic overload once using the existing
Aspire.Hosting.Radius/withContainerImagecapability ID, and exclude the legacy overload from ATS discovery. Both public C# overloads and scanner collision policy remain unchanged. Add real-assembly generation/scanning and runtime-dispatch regressions for legacy projects, file-based apps, and modern .NET projects. No new external package dependencies are required.Fixes #21803
User-facing usage
With the Radius and Dotnet integrations referenced, TypeScript AppHosts can again use:
The corresponding C# API is unchanged:
Compatibility
The retained capability now targets and returns
IDotnetProgramResourcein ATS metadata, while generated methods preserve each resource's concrete fluent return type. A scoped compatibility suppression records that intentional metadata generalization; generated release baselines are untouched.The separate earlier-preview
Aspire.Hosting.Radius/withDotnetProgramContainerImagecapability ID is retired. SDKs generated against that preview ID must be regenerated.Validation
Reproduced the missing method with Aspire CLI/SDK 13.6.4 and the integration versions from the issue. Strict TypeScript compilation failed for the modern resource before the fix and passed against the patched generated SDK.
The following commands passed on macOS ARM64 with Podman selected. Quarantined and outerloop tests were excluded. No live Radius deployment was run.
The patched generated SDK also passed the following command from an isolated TypeScript AppHost containing concrete and promise-chain calls for all three resource types:
Fresh ATS compatibility validation passed with exactly one declared return-type-change suppression and no undeclared breaks. Evaluated test-selection traces reach both new regression consumers from Radius production changes and select the compatibility job for the suppression file.
Checklist
<remarks />and<code />elements on your triple slash comments?