Repository navigation
Detect duplicate polyglot capability IDs - #16530
Merged
Sébastien Ros (sebastienros) merged 3 commits intoApr 28, 2026
Merged
Sébastien Ros (sebastienros) merged 3 commits into
Sébastien Ros (sebastienros) merged 3 commits into
Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16530Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16530" |
Contributor
Author
|
This PR is supposed to fail until #16498 is merged |
Contributor
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends AspireExportAnalyzer with a new warning rule (ASPIREEXPORT013) to detect assembly-wide polyglot capability ID collisions, including collisions arising from static exports and context-type exports (via ExposeMethods / ExposeProperties). This aligns analyzer behavior more closely with the runtime ATS capability scanner so collisions are caught at build time.
Changes:
- Added ASPIREEXPORT013 diagnostic descriptor and release-tracking entry.
- Implemented compilation-wide capability ID collection and duplicate reporting (new compilation-end pass).
- Updated analyzer unit tests to cover duplicate capability IDs across target types, non-extension exports, and exposed context-type overloads.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Analyzers.Tests/AspireExportAnalyzerTests.cs | Adds/updates test cases to validate ASPIREEXPORT013 warnings for several collision scenarios. |
| src/Aspire.Hosting.Integration.Analyzers/AspireExportAnalyzer.Diagnostics.cs | Introduces ASPIREEXPORT013 descriptor and adds it to supported diagnostics. |
| src/Aspire.Hosting.Integration.Analyzers/AspireExportAnalyzer.cs | Implements capability-ID tracking across the compilation and reports duplicates at compilation end. |
| src/Aspire.Hosting.Integration.Analyzers/AnalyzerReleases.Unshipped.md | Documents the new analyzer rule in the unshipped release notes. |
Add ASPIREEXPORT013 to flag assembly-wide polyglot capability ID collisions, including static exports and context type members exposed through AspireExport. Co-authored-by: Copilot <[email protected]>
Handle assembly-level context exports, generic context type names, and runtime-filtered methods when tracking ASPIREEXPORT013 capability IDs. Co-authored-by: Copilot <[email protected]>
Give Gateway and Ingress hostname and TLS exports unique capability IDs while preserving generated polyglot method names, and cover them in the polyglot apphosts. Co-authored-by: Copilot <[email protected]>
David Fowler (davidfowl)
approved these changes
Apr 28, 2026
Sébastien Ros (sebastienros)
merged commit Apr 28, 2026
69584b8
into
microsoft:main
564 of 567 checks passed
Sébastien Ros (sebastienros)
deleted the
sebastienros/sebros-polyglot-collisions
branch
April 28, 2026 20:01
22 of 25 tasks
Nell Shamrell-Harrington (nellshamrell)
pushed a commit
to nellshamrell/aspire
that referenced
this pull request
May 18, 2026
* Detect duplicate polyglot capability IDs Add ASPIREEXPORT013 to flag assembly-wide polyglot capability ID collisions, including static exports and context type members exposed through AspireExport. Co-authored-by: Copilot <[email protected]> * Align capability collision analyzer with scanner Handle assembly-level context exports, generic context type names, and runtime-filtered methods when tracking ASPIREEXPORT013 capability IDs. Co-authored-by: Copilot <[email protected]> * Disambiguate Kubernetes gateway and ingress exports Give Gateway and Ingress hostname and TLS exports unique capability IDs while preserving generated polyglot method names, and cover them in the polyglot apphosts. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Polyglot capability IDs must be unique within an assembly, but the existing analyzer only caught duplicate export IDs for the same target type. This adds ASPIREEXPORT013 to detect assembly-wide generated capability ID collisions, including static exports and members exposed from
[AspireExport(ExposeMethods/ExposeProperties)]context types.The analyzer now mirrors the capability ID shapes used by the ATS scanner closely enough to catch collisions like differently targeted static exports with the same generated ID and overloaded context-type methods that produce the same capability ID. This PR intentionally does not change the Kubernetes exports themselves; that fix is handled separately.
Fixes # (issue)
N/A
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: