Skip to content

[docs] Document ArgumentException for Subscribe(T) with interface/abstract event types - #1531

Closed
aspire-repo-bot[bot] wants to merge 3 commits into
release/13.5from
docs/pr-17094-32146456680-1-4392fabfa3f5cef8
Closed

[docs] Document ArgumentException for Subscribe(T) with interface/abstract event types#1531
aspire-repo-bot[bot] wants to merge 3 commits into
release/13.5from
docs/pr-17094-32146456680-1-4392fabfa3f5cef8

Conversation

@aspire-repo-bot

@aspire-repo-bot aspire-repo-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Documents changes from microsoft/aspire#17094

@maddymontaquila

Targeting release/13.5 — the latest release branch on microsoft/aspire.dev — because release/13.4 (from the source PR milestone 13.4) does not exist there.

Why

microsoft/aspire#17094 makes Eventing.Subscribe<T>() throw an ArgumentException when T is an interface or abstract class, such as IDistributedApplicationEvent.

The eventing docs page showed the Eventing.Subscribe<T>() API but didn't mention that subscriptions require a concrete event type, so this PR documents the public contract and exception behavior.

Changes

  • src/frontend/src/content/docs/app-host/eventing.mdx: adds one concise caution Aside after the Eventing.Subscribe<T>() examples explaining that T must be concrete, preserving the exact ArgumentException message, and naming valid concrete event types.
  • Removes the generated sample that incorrectly subscribed to IDistributedApplicationEvent, the exact interface rejected by the new guard.

Existing page updated (no new pages created).

Validation

  • pnpm --dir .\src\frontend run lint
  • pnpm --dir .\src\frontend exec vitest run --config vitest.config.ts tests/unit/topic-resolver.vitest.test.ts tests/unit/seo-lengths.vitest.test.ts (15 tests)

Generated by PR Documentation Check · auto · 35 AIC · ⌖ 9.95 AIC · ⊞ 19.6K ·

…ract event types

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aspire-repo-bot aspire-repo-bot Bot added the docs-from-code Copilot initiated issue from dotnet/aspire repo label Aug 18, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor Author

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #1531. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #1531 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

@IEvangelist David Pine (IEvangelist) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fail-closed source audit found two blocking defects at exact head dc8763ea15df695fcd935a0e2463de2db8bf291d:

  1. The code sample subscribes to IDistributedApplicationEvent, the exact interface the new guard rejects. Running it throws the ArgumentException described immediately above, so it cannot be presented as a valid callback sample. Remove the redundant sample or use a concrete event type.
  2. Preserve the exception text as one intact inline literal: Cannot subscribe to interface or abstract type 'IDistributedApplicationEvent'. Subscribe to a concrete event type instead.

The authoritative source is microsoft/aspire#17094 (1a56825a3f0e9c9ddff8f87473c8c91048f1a88a), where Subscribe<T> rejects typeof(T).IsInterface || typeof(T).IsAbstract. Keep this PR draft and do not merge it until a corrected exact head passes CI, Copilot, and thread gates and receives independent human approval.

Remove the example that subscribes to the forbidden interface and preserve the exact ArgumentException message in one concise caution.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 32c349b4-907d-42e9-aad8-2f0edc267779
@IEvangelist

Copy link
Copy Markdown
Member

Superseded by #1532, rebuilt from the latest release/13.5 head with clean branch provenance. Closing this draft unmerged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-from-code Copilot initiated issue from dotnet/aspire repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants