-
Notifications
You must be signed in to change notification settings - Fork 5k
Host: log exception if a service factory fails #112534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Tagging subscribers to this area: @dotnet/area-extensions-hosting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
cc @halter73 for any feedback. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look reasonable and low-risk and will help diagnose issues with configuring the services.
Currently, the host doesn't log any exception if a
IHostedService
orIStartupValidator
service factory fails. If you useRunAsync
you also have no way to log it yourself since the host has already been disposed after it returns (see also #72225).This catches any exceptions thrown by the
GetService
calls and logs and re-throws the exception, similiarly on how it is already done for exceptions inStartAsync
etc. .