Repository navigation
Conversation
Demivan
requested review from
a team,
Youssef1313,
cincuranet,
davpetr and
rokonec
as code owners
October 6, 2026 14:40
Contributor
|
Thanks for your PR, @Demivan. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
1 task done
Demivan
force-pushed
the
fix/deferredhost-disposed-start
branch
from
October 7, 2026 07:41
6ff4763 to
f8ec6e4
Compare
Contributor
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
When the app under test fails in IHost.StartAsync, app.Run() disposes the host before the entry point exits and reports the exception through EntryPointCompleted. If the disposal won the race with DeferredHost.StartAsync resolving IHostApplicationLifetime, the factory threw ObjectDisposedException and the real startup exception was lost. Skip the ApplicationStarted registration when the host is already disposed and keep awaiting the start TCS. HostFactoryResolver reports entry point completion in a finally, so the TCS always completes with the app's exception or result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Demivan
force-pushed
the
fix/deferredhost-disposed-start
branch
from
October 17, 2026 16:32
f8ec6e4 to
ffcee02
Compare
This branch has not been deployed
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.
Rethrow the app's startup exception instead of ObjectDisposedException
Description
When the app under test fails in
IHost.StartAsync,app.Run()disposes the host before the entry point exits. If that happens beforeDeferredHost.StartAsyncresolvesIHostApplicationLifetime,WebApplicationFactorythrowsObjectDisposedExceptionand the real startup exception is lost.DeferredHost.StartAsyncnow skips theApplicationStartedregistration when the host is already disposed and keeps awaiting the start TCS. The entry point is exiting at that point, andHostFactoryResolverreports its completion in afinally, soEntryPointCompletedalways completes the TCS with the app's exception or result. The success and cancellation paths are unchanged.The regression test uses
SimpleWebSiteWithWebApplicationBuilderwith a failingValidateOnStart. Its factory holdsCreateHostuntil the app's service provider has been disposed, which makes the ordering deterministic. Without the fix it failed 10/10 runs with the reportedObjectDisposedExceptionstack. With the fix it passed 10/10, andMvc.FunctionalTestspasses in full (1669 passed, 3 skipped).Fixes #69684
🤖 Generated with Claude Code