Skip to content

[docs] Document recursive MTP test runner invocation guard in testing docs - #1804

Draft
aspire-repo-bot[bot] wants to merge 1 commit into
release/17.0from
docs/pr-20573-36883974620-1-94cef80e8b73ad03
Draft

aspire-repo-bot[bot] wants to merge 1 commit into
release/17.0from
docs/pr-20573-36883974620-1-94cef80e8b73ad03

Conversation

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Documents changes from microsoft/aspire#20573

@danegsta

Target branch: Targeting release/17.0 based on the source PR milestone 17.0 (exact match on microsoft/aspire.dev).

Why this is needed

microsoft/aspire#20573 adds a safety check to DistributedApplicationTestingBuilder.CreateAsync that detects when a Microsoft.Testing.Platform test project is itself built with Aspire.AppHost.Sdk. In that situation the generated Projects.* type can belong to the test application instead of the AppHost, and invoking its entry point recursively re-runs the entire test suite (potentially leaving stray AppHost/DCP processes running). The fix throws a clear InvalidOperationException instead of silently recursing.

This is a new, previously undocumented failure mode and diagnostic message that users of DistributedApplicationTestingBuilder can now hit, so the testing docs need to explain the symptom and the fix.

What changed

Added a new "Avoid building test projects with Aspire.AppHost.Sdk" section to src/frontend/src/content/docs/testing/advanced-scenarios.mdx (alongside the existing "File-based AppHost limitations" section), covering:

  • The root cause: test projects built with Aspire.AppHost.Sdk instead of Microsoft.NET.Sdk.
  • The exact InvalidOperationException message users will see.
  • The three remediation options called out in the source PR: switch the test project to Microsoft.NET.Sdk with a <ProjectReference> to the AppHost, load the AppHost assembly dynamically and pass a type to CreateAsync(Type), or use DistributedApplicationTestingBuilder.Create() when no entry-point invocation is needed.

Files modified

  • src/frontend/src/content/docs/testing/advanced-scenarios.mdx (updated)

No new pages were created; this extends an existing troubleshooting-style page that already documents a related AppHost-testing limitation.

Generated by PR Documentation Check for #20573 · copilot · auto · 58.3 AIC · ⌖ 16.6 AIC · ⊞ 20.3K · ◷

Adds a troubleshooting section to the advanced testing scenarios page
explaining why Aspire.AppHost.Sdk test projects can recursively invoke
the test runner via DistributedApplicationTestingBuilder.CreateAsync,
and how to fix it (Microsoft.NET.Sdk + ProjectReference, dynamic
assembly loading, or DistributedApplicationTestingBuilder.Create()).

Documents microsoft/aspire#20573

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 Oct 1, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor Author

Frontend HTML artifact ready

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

VS Code: Open PR #1804 artifacts

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

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.

0 participants