Document TestingPlatformBuilderHook auto-registration for MTP extension authors#54122
Open
Evangelink wants to merge 2 commits into
Open
Document TestingPlatformBuilderHook auto-registration for MTP extension authors#54122Evangelink wants to merge 2 commits into
Evangelink wants to merge 2 commits into
Conversation
…on authors Addresses microsoft/testfx#5552 by adding a new section to the MTP extensions architecture article that explains: - How extension authors expose a TestingPlatformBuilderHook class and ship a buildMultiTargeting props file so consumers don't need manual registration. - The required AddExtensions(ITestApplicationBuilder, string[]) method signature and the required MSBuild item metadata (Include, DisplayName, TypeFullName). - That the Include GUID is a freshly generated, random identifier that must not be reused from any other extension (with an IMPORTANT callout) and is distinct from IExtension.Uid. - How to verify the hook is wired up by inspecting the generated SelfRegisteredExtensions.g.cs file. Also adds a TIP at the top of the Extensibility points section pointing readers to the new section, and bumps ms.date. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the Microsoft.Testing.Platform (MTP) extensions architecture documentation to explain how extension authors can participate in MSBuild-driven auto-registration via a TestingPlatformBuilderHook, so consumers don’t need to add manual registration calls in Main.
Changes:
- Adds a new section that documents the
TestingPlatformBuilderHookclass shape, required method signature, and the MSBuildTestingPlatformBuilderHookitem in abuildMultiTargeting/<PackageId>.propsfile. - Adds guidance about the
IncludeGUID’s purpose (deduplication) and how to verify wiring via the generatedSelfRegisteredExtensions.g.cs. - Adds a tip callout near the top of Extensibility points pointing readers to the new auto-registration section and bumps
ms.date.
Show a summary per file
| File | Description |
|---|---|
| docs/core/testing/microsoft-testing-platform-architecture-extensions.md | Documents TestingPlatformBuilderHook auto-registration, adds a cross-reference tip, and updates the article date. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Addresses microsoft/testfx#5552 by documenting the
TestingPlatformBuilderHookauto-registration mechanism for Microsoft.Testing.Platform (MTP) extension authors.What changed
Adds a new
## Auto-register your extension with TestingPlatformBuilderHooksection todocs/core/testing/microsoft-testing-platform-architecture-extensions.mdthat explains:public static class TestingPlatformBuilderHookwith theAddExtensions(ITestApplicationBuilder, string[])signature, including a sample mirroring how in-box extensions likeMicrosoft.Testing.Extensions.Retryship.buildMultiTargeting/<PackageId>.propsfile that declares a<TestingPlatformBuilderHook>item withInclude,DisplayName, andTypeFullNamemetadata.IncludeGUID is a random identifier – an explicit subsection clarifying that this GUID is not the same asIExtension.Uid, that it must be freshly generated for every new extension, and (with an[!IMPORTANT]callout) that copying a GUID from another extension causes the hook to be deduplicated away and silently fail to register. Includes a few ways to generate one (PowerShell, Visual Studio,uuidgen).SelfRegisteredExtensions.g.csfile and common reasons the call might be missing.Also adds:
[!TIP]callout at the top of the## Extensibility pointssection pointing readers to the new section so they don't miss it while reading individual extension docs.ms.datebump.Why
Issue microsoft/testfx#5552 (from @Youssef1313) called out that the article doesn't tell extension authors how to plug into the auto-generated entry point and doesn't make it clear that the registration GUID must be freshly generated. The article previously only showed the manual
builder.TestHost.AddXxx(...)registration calls, leaving authors to reverse-engineer the pattern from in-box extension sources.Content sources
Microsoft.Testing.Extensions.Retry/TestingPlatformBuilderHook.csand the_expectedItemSpecconstant inTestingPlatformAutoRegisteredExtensions.cs.Microsoft.Testing.Extensions.Retry.propsand the MSBuild task's metadata constants.ValidateAndDeduplicateBuilderHooksinTestingPlatformAutoRegisteredExtensions.cs.GetSourceCodeinTestingPlatformAutoRegisteredExtensions.cs.GenerateTestingPlatformEntryPoint=false)microsoft-testing-platform-intro.md,microsoft-testing-platform-features.md, and several extension articles in this repo.Note
Per repo convention, the AI-usage frontmatter is unchanged (
ai-assisted) because this article was already marked as such.Validation
npx -y markdownlint-cli2 docs/core/testing/microsoft-testing-platform-architecture-extensions.md→ 0 errors.#auto-register-your-extension-with-testingplatformbuilderhook,#the-include-guid-is-a-random-identifier,./microsoft-testing-platform-architecture.md#the-iextension-interface) were derived from the corresponding heading text per Docs anchor rules.Closes microsoft/testfx#5552 (docs side).
Internal previews