V11.2.0/startup fix - #68
Merged
Merged
Conversation
Introduces ManagedApplicationFixture and ManagedWebApplicationFixture for opt-in entrypoint-owned startup, enabling the application's Main method to own host configuration and lifecycle. Adds internal deferred host infrastructure to capture and lazily start hosts when the test host is consumed. Updates framework abstractions (HostTest, HostFixture) to support both legacy and managed startup paths for backward compatibility during this minor release. Refactors ApplicationHostFactory and WebApplicationTestFactory to route managed fixture requests through the deferred path. Marks BlockingManagedApplicationFixture and BlockingManagedWebApplicationFixture as obsolete. Updates bootstrap sample applications to demonstrate all startup patterns.
Adds comprehensive regression test coverage for the new managed startup patterns across Generic Host and ASP.NET Core scenarios. Includes new functional tests validating entrypoint-owned startup for classic, minimal, Bootstrapper, worker, and modern entry points. Verifies that explicit fixture selection (managed vs blocking) produces the expected startup behavior. Updates existing tests to confirm backward compatibility of legacy factory paths.
Updates DocFX namespace pages and type-level API documentation to reflect the new managed application and web application fixtures. Clarifies the distinction between the new managed startup path (where the application entry point owns host initialization) and the legacy factory/blocking paths (which preserve startup behavior for this minor release). Adds usage guidance and deprecation notices to the API documentation.
Updates NuGet package release notes and README documentation for Codebelt.Extensions.Xunit.Hosting and Codebelt.Extensions.Xunit.Hosting.AspNetCore packages. Adds 'Unreleased' section highlighting the new managed fixtures as the primary feature. Documents the compatibility split: ManagedApplicationFixture and ManagedWebApplicationFixture enable applications where Main owns startup configuration; legacy factory and blocking fixture APIs preserve existing behavior for backward compatibility.
Updates CHANGELOG.md with 11.2.0 release entry documenting the introduction of entrypoint-owned managed fixtures as an opt-in startup path. Highlights backward compatibility split: new ManagedApplicationFixture<TEntryPoint> and ManagedWebApplicationFixture<TEntryPoint> allow applications where the entry point manages host initialization; existing factory and blocking fixture APIs remain unchanged for this minor release. Notes deprecation of BlockingManagedApplicationFixture and BlockingManagedWebApplicationFixture in favor of managed fixtures.
Greptile SummaryThe PR adds opt-in managed fixtures that defer host startup to the application entry point while retaining obsolete blocking fixtures for compatibility.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
X[xUnit constructs managed fixture] --> T[Test class passes fixture to base constructor]
T --> C[ConfigureHost initializes deferred host]
C --> E[Application entry point owns startup]
E --> A[Test consumes Host or Server]
A --> S[Deferred host starts and exposes services or TestServer]
S --> D[xUnit fixture lifecycle disposes host]
Reviews (3): Last reviewed commit: "🐛 fix bootstrapper async startup and ca..." | Re-trigger Greptile |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #68 +/- ##
==========================================
+ Coverage 92.25% 94.27% +2.01%
==========================================
Files 82 88 +6
Lines 1498 1658 +160
Branches 169 180 +11
==========================================
+ Hits 1382 1563 +181
+ Misses 102 81 -21
Partials 14 14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Remove CreateEntrypointOwnedHost and ReleaseEntrypoint protected methods from HostFixture and inline their logic directly into ManagedApplicationFixture and ManagedWebApplicationFixture. This simplifies the public API surface of HostFixture by keeping entrypoint-owned host logic scoped to the fixtures that use it. Refactor exception handling in DeferredHostBuilder to remove unnecessary try-catch wrapping.
Add integration test to verify ManagedApplicationFixture correctly initializes through ConfigureHost and starts the application entrypoint. Also add test to verify BootstrapperMinimalConsoleProgram handles cancellation gracefully.
Update ManagedApplicationFixture and ManagedWebApplicationFixture documentation examples to show the proper usage pattern: inherit from ApplicationTest or WebApplicationTest base classes and pass the fixture to the base constructor for automatic fixture initialization via ConfigureHost.
Move catch clause to the same line as the closing brace of the try block for consistent formatting style.
Fix the bootstrapper startup to properly implement async/await patterns and respect application lifetime cancellation signals. This ensures the hosted application can be gracefully shutdown by the framework rather than completing immediately.
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.
This pull request introduces new "managed" fixture types for both application and ASP.NET Core integration testing, shifting ownership of host startup to the application's real entry point. The new
ManagedApplicationFixture<TEntryPoint>andManagedWebApplicationFixture<TEntryPoint>provide an opt-in, deferred startup path, while the legacy blocking fixtures are now marked as obsolete for compatibility and will be removed or changed in the next major release. Documentation and examples have been updated to reflect these changes and guide users toward the new recommended patterns.New Features:
ManagedApplicationFixture<TEntryPoint>andManagedWebApplicationFixture<TEntryPoint>as opt-in, entrypoint-owned fixtures for application and ASP.NET Core tests, respectively. These fixtures allow the application'sMainmethod to control startup, with host/server startup deferred until consumed by the test. (.nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt [1] .nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt [2] .docfx/api/types/Codebelt.Extensions.Xunit.Hosting.ManagedApplicationFixture%601.md [3] .docfx/api/types/Codebelt.Extensions.Xunit.Hosting.AspNetCore.ManagedWebApplicationFixture%601.md [4]Deprecations and Compatibility:
BlockingManagedApplicationFixture<TEntryPoint>andBlockingManagedWebApplicationFixture<TEntryPoint>as obsolete compatibility fixtures; documentation and examples now direct users to the new managed fixtures for entrypoint-owned startup. These types are retained for the current minor release and will be removed or changed in the next major release. (.nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt [1] .nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt [2] .docfx/api/types/Codebelt.Extensions.Xunit.Hosting.BlockingManagedApplicationFixture%601.md [3] .docfx/api/types/Codebelt.Extensions.Xunit.Hosting.AspNetCore.BlockingManagedWebApplicationFixture%601.md [4]Documentation and Guidance Updates:
Examples and API Reference:
Release Notes: