Repository navigation
Remove InternalsVisibleTo from Aspire.Hosting to Aspire.Hosting.Radius - #20143
Conversation
Radius only needed two `src/Shared/` helpers (`EnvironmentVariableNameEncoder` and `KnownRelationshipTypes`) from Aspire.Hosting. Those are plain internal source files, not Aspire.Hosting API, so link-compile them instead of taking an IVT grant on the whole assembly. Aspire.Hosting.DevTunnels already links these same two files for the same reason. The comment justifying the grant was stale: it cited ProjectLaunchDefaultsAnnotation.DefaultHttpsEndpoint, which is now public (behind ASPIREPROJECTS001) and no longer requires IVT. Co-authored-by: Copilot App <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20143Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20143" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟢 Approval recommended
The mechanical dependency change is complete and consistent with the existing DevTunnels pattern.
Pull request overview
Removes Radius’s access to Aspire.Hosting internals while preserving behavior through shared-source compilation.
Changes:
- Removes the Radius
InternalsVisibleTogrant. - Link-compiles the two required shared helpers into Radius.
File summaries
| File | Description |
|---|---|
src/Aspire.Hosting/Aspire.Hosting.csproj |
Removes the Radius IVT grant and stale justification. |
src/Aspire.Hosting.Radius/Aspire.Hosting.Radius.csproj |
Includes the required shared helper sources. |
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.
There was a problem hiding this comment.
🟢 Approval recommended
The focused dependency-boundary change preserves the existing helper implementations without introducing unresolved issues.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Tests selector50 / 99 PR test projects · 4 PR jobs, from 2 changed files. Selected PR test projects (50 / 99)
Selected PR jobs (4)
How these were chosen — grouped by what changed
🔧 show 48
📦 affected project 🔧 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
✅ No documentation update needed. Step 5 branch taken: Triggered signals: no signals triggered (signal_count = 0) Rationale: Only two files changed, both build configuration (no source/API changes):
The change removes an |
|
🔍 CI Failure Analysis: Transient Infrastructure Failure The CI build failed due to transient infrastructure issues. Failed jobs:
If a rerun was not already requested automatically, visit the workflow run page to rerun the failed jobs manually. |
Description
Aspire.Hostinghands outInternalsVisibleTotoAspire.Hosting.Radius, which means the entire internal surface of the core hosting assembly is reachable from that integration. Every IVT grant like this makes the internal surface harder to refactor, because a change to any internal member can break a downstream package that was never meant to depend on it.This removes that grant. It turns out Radius wasn't consuming Aspire.Hosting internals at all in any meaningful sense — it only needed two helpers that live in
src/Shared/:EnvironmentVariableNameEncoder(src/Shared/EnvironmentVariableNameEncoder.cs)KnownRelationshipTypes(src/Shared/Model/KnownRelationshipTypes.cs)These are plain internal source files that get link-compiled into whichever assembly needs them. They are not Aspire.Hosting API. So instead of granting IVT over all of
Aspire.Hostingto reach them,Aspire.Hosting.Radiusnow link-compiles the two files directly, exactly likeAspire.Hosting.DevTunnelsalready does — and DevTunnels needs no IVT as a result.Aspire.Hosting.Radiusnow builds against the publicAspire.Hostingsurface only, joiningAspire.Hosting.JavaandAspire.Hosting.Rust, which document that same property in their csproj files.Stale justification removed
The grant carried this comment:
That is no longer accurate.
ProjectLaunchDefaultsAnnotationandDefaultHttpsEndpointare both public today (behind theASPIREPROJECTS001experimental diagnostic), andRadiusServiceDiscovery.csconsumes them through the public surface. The comment was pointing at a reason that had already been designed away.How the set of required internals was determined
Rather than inferring usage from source searches, the grant was removed and the consumer rebuilt, so the compiler enumerated exactly what was inaccessible. That produced three errors across one file, all in
RadiusInfrastructureBuilder.cs, and both offending types were shared-source helpers rather than real hosting API. The same probe was run against the other non-test grants to confirm none of them are in the same situation —Aspire.Hosting.Blazor,Aspire.Hosting.EntityFrameworkCore,Aspire.Hosting.Azure.ContainerRegistry,Aspire.Hosting.Foundry, andAspire.Hosting.Azure.Kubernetesall consume genuine internal infrastructure with no public equivalent, so they are intentionally left alone here.Validation
Aspire.Hosting.RadiusandAspire.Hosting.Radius.Testsbuild clean: 0 errors, 0 warnings.build.cmd -build): 0 errors, 0 warnings.Aspire.Hosting.Radius.Tests: 655/655 passing, 0 failed, 0 skipped.No behavior change is expected or intended: the same helper code is compiled, just sourced by link instead of by IVT.
Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?