[docs] Document ArgumentException for Subscribe(T) with interface/abstract event types - #1531
Conversation
…ract event types Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
David Pine (IEvangelist)
left a comment
There was a problem hiding this comment.
Fail-closed source audit found two blocking defects at exact head dc8763ea15df695fcd935a0e2463de2db8bf291d:
- The code sample subscribes to
IDistributedApplicationEvent, the exact interface the new guard rejects. Running it throws theArgumentExceptiondescribed immediately above, so it cannot be presented as a valid callback sample. Remove the redundant sample or use a concrete event type. - 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
|
Superseded by #1532, rebuilt from the latest |
Documents changes from microsoft/aspire#17094
@maddymontaquilaTargeting
release/13.5— the latest release branch onmicrosoft/aspire.dev— becauserelease/13.4(from the source PR milestone13.4) does not exist there.Why
microsoft/aspire#17094 makes
Eventing.Subscribe<T>()throw anArgumentExceptionwhenTis an interface or abstract class, such asIDistributedApplicationEvent.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 concisecautionAside after theEventing.Subscribe<T>()examples explaining thatTmust be concrete, preserving the exactArgumentExceptionmessage, and naming valid concrete event types.IDistributedApplicationEvent, the exact interface rejected by the new guard.Existing page updated (no new pages created).
Validation
pnpm --dir .\src\frontend run lintpnpm --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)