You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The configured factory is a fully qualified, parameterless static method returning Task<IHost>. It returns one fresh, unstarted host and receives no MTP command-line arguments. Generated code starts/stops the host through RunTestingPlatformAsync, prefers IAsyncDisposable, and preserves the original run failure if disposal also fails.
HostOwned requires Microsoft.Testing.Extensions.OpenTelemetry and contributes only AddTestingPlatformDiagnostics(). The application host remains the sole owner of OpenTelemetry providers, exporters, and service.*/host/OS/process resource identity.
Compatibility defaults
when TestingPlatformHostFactory is unset, the existing generated entry point remains unchanged
GenerateTestingPlatformEntryPoint=false and handwritten/manual Hosting composition remain supported
referencing Hosting alone does not opt a project into generated hosting
explicit hosted mode fails clearly for missing/incompatible Hosting or OpenTelemetry package capabilities, disabled self-registration/helper generation, VSTest mode, malformed factories, or protocol-version skew
C#, Visual Basic, and F# use the same ownership/lifecycle contract
Validation
MSBuild generator unit tests: 140 passed
Microsoft.Testing.Extensions unit tests: 2,029 passed, 7 skipped
generated package-consuming acceptance: 16 passed across net462, net8.0, net9.0, and net10.0
Hosting 8/9/10 compatibility
direct and response-file help bypass
JSON listing stdout integrity
HostOwned builder span, final run metric flush, and preserved service identity
async-only host service disposal
package-consuming Visual Basic and F# hosted-entry-point acceptance: 2 passed
package-consuming C#, Visual Basic, and F# builds with warnings as errors
exact Windows public-sample Release build: 13/13 solutions passed with binary logs
Windows and Linux Release pack validation, including Hosting package build/buildTransitive/buildMultiTargeting content
API baseline, package metadata, BOM, and git diff --check validation
two fresh review rounds plus MSBuild and lifecycle specialist passes; actionable findings fixed
Bounded limitations
configuration-only help/info is resolved after factory construction; direct and response-file help/info bypass the factory
process-restart extensions can invoke the factory in both controller and child processes until MTP exposes a role-aware pre-build lifecycle seam; such factories should avoid exclusive global resources such as fixed ports
hosted logging, services, and exporters must remain stdout-silent because JSON listing, server, and dotnet test protocols reserve stdout
advanced or role-specific composition can continue to use an explicit Program.cs
coverable once the parallel-safety analyzers ship (attribute in Program.cs)
Microsoft.Testing.Extensions.UnitTests
MethodLevel
CPU count (Workers = 0)
coverable once the parallel-safety analyzers ship (attribute in Program.cs)
Microsoft.Testing.Platform.MSBuild.UnitTests
MethodLevel
CPU count (Workers = 0)
coverable once the parallel-safety analyzers ship (attribute in Program.cs)
Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — no severities to report.
Analysis performed:
New acceptance tests (GeneratedHostedEntryPointValidationTests, GeneratedHostedLanguageEntryPointTests, GeneratedMicrosoftExtensionsHostingTests) build fresh assets via TestAsset.GenerateAssetAsync, which allocates a unique TempDirectory per call (Path.Combine(tempDirectory.Path, assetId)) — no shared-path collisions across concurrently-runnable tests, including the TempDirectory-based response-file scratch path in GeneratedMicrosoftExtensionsHostingTests.GeneratedEntryPoint_ResponseFileHelpDoesNotCreateHost.
New unit tests in MicrosoftExtensionsHostingExtensionsTests.cs (ShouldBypassApplicationHost_ExpandsResponseFiles, the host-lifetime/cancellation tests) use Path.GetTempPath() + Guid.NewGuid() for uniqueness and instance-only mock/list fields (Mock<IBuildEngine>, List<BuildErrorEventArgs> in MSBuildTests.cs) — no static mutable state introduced.
The only process-global mutation in scope (Environment.SetEnvironmentVariable in TestInitialize/TestCleanup) is pre-existing (predates this PR) and is already correctly declared via the class-level [ResourceLock(WellKnownResources.EnvironmentVariables)] on MicrosoftExtensionsHostingExtensionsTests; the PR's new test methods correctly inherit that declaration with no under/over-declaration.
No changes to [ResourceLock] / [DoNotParallelize] / [Parallelize] declarations, .runsettings, testconfig.json, or MSBuild parallelization properties in this PR.
Nothing unsafe found. All three audited assemblies opt into MethodLevel parallelism via [assembly: Parallelize] in their Program.cs (unchanged by this PR).
Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
github.com
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
The cross-language generator, NuGet build assets, and cancellation lifecycle span several compatibility-sensitive boundaries requiring final human review.
new EntryPointTask_ Rejects_ Invalid_ Host_ Factory
1/3 killed
Only exercises the too-few-segments branch of IsValidHostFactory.
Add DataRow cases for an invalid character and an empty segment.
C (70–79)
new ShouldBypassApplicationHost_ Recognizes Informational Options
1/2 killed
Only asserts the true path; an always-true mutation survives.
Add a non-bypass DataRow and assert IsFalse.
A (90–100)
new ShouldBypassApplicationHost_ ExpandsResponseFiles
1/1 killed
Verifies the response-file expansion branch with real file I/O.
—
A (90–100)
new RunTestingPlatformAsync_ WithoutHostApplicationLifetime_ PreservesPreviousBehavior
1/1 killed
Confirms the optional-lifetime null-bridge path preserves the prior exit code.
—
A (90–100)
new RunTestingPlatformAsync_ WhenHostStops_ CancelsMtp
1/1 killed
Focused test confirming host-initiated stop cancels MTP with the expected exit code.
—
A (90–100)
new RunTestingPlatformAsync_ WhenMtpStops_ RequestsHostStop
2/2 killed
Asserts both exit code and that MTP-initiated stop actually requests host shutdown.
—
A (90–100)
new EntryPointTask_ GloballyQualifies_ FSharp_ HostFactory_ Without_ RootNamespace
1/1 killed
Verifies the rootless F# template globally qualifies the factory (regression test for a review finding).
—
A (90–100)
new EntryPointTask_ Generates_ Hosted_ Application_ For_ All_ Supported_ Languages
4/4 killed
Data-driven across C#/VB/F#; asserts factory call, run/dispose/bypass wiring, and single self-registration.
—
This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with /review-tests.
🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · copilot · auto · 306.9 AIC · ⌖ 8.06 AIC · ⊞ 17.9K · ◷
The advertised two-property opt-in does not compile cleanly for C# or VB: both generated templates call the [Experimental("TPEXP")] Hosting API without suppressing TPEXP, while every new C#/VB consumer and sample has to add <NoWarn>$(NoWarn);TPEXP</NoWarn>. F# already emits #nowarn "57". Emit the equivalent suppression in the generated C# and VB sources, or make the extra suppression part of the documented opt-in contract; otherwise the documented snippet fails for warnings-as-errors consumers.
This lexical check accepts language keywords, so values such as Contoso.class.TestHost.CreateHost pass validation and are then emitted as invalid C#; the same path can succeed for one language and fail for VB or F# because their keyword sets differ. That defeats the promised actionable validation for malformed factories and leaves users with generated-source compiler errors. Make validation/code generation language-aware and either reject reserved segments here or escape them for the selected language (also using the existing identifier-character helpers rather than char.IsLetterOrDigit).
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
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.
Summary
Microsoft.Testing.Extensions.Hostingbridge instead of requiring a handwrittenProgram.csfor common ASP.NET Core and Aspire testsOpt-in contract
The configured factory is a fully qualified, parameterless static method returning
Task<IHost>. It returns one fresh, unstarted host and receives no MTP command-line arguments. Generated code starts/stops the host throughRunTestingPlatformAsync, prefersIAsyncDisposable, and preserves the original run failure if disposal also fails.HostOwnedrequiresMicrosoft.Testing.Extensions.OpenTelemetryand contributes onlyAddTestingPlatformDiagnostics(). The application host remains the sole owner of OpenTelemetry providers, exporters, andservice.*/host/OS/process resource identity.Compatibility defaults
TestingPlatformHostFactoryis unset, the existing generated entry point remains unchangedGenerateTestingPlatformEntryPoint=falseand handwritten/manual Hosting composition remain supportedValidation
net462,net8.0,net9.0, andnet10.0git diff --checkvalidationBounded limitations
dotnet testprotocols reserve stdoutProgram.cs