Skip to content
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

CLI is running all registered IHostedService #2712

Closed
desjoerd opened this issue Sep 26, 2023 · 4 comments · Fixed by #2880
Closed

CLI is running all registered IHostedService #2712

desjoerd opened this issue Sep 26, 2023 · 4 comments · Fixed by #2880
Assignees
Milestone

Comments

@desjoerd
Copy link
Contributor

Currently the CLI is running all registered Hosted Services (IHostedService). I see that it's needed to start the application because otherwise the app.Use*/app.Map* configuration is not run. Because it's starting the application (with a NoopServer) it is running all registered HostedServices.

Because the CLI is almost always run in the context of a build it would be nice to not run those registered hosted services. This would also solve instances of for example HangFire or other things which start an IHostedService.

I've got a fix which I would like to discuss. It's a bit dirty but it works in my tests.

@0xced
Copy link
Contributor

0xced commented Oct 4, 2023

Related: dotnet-getdocument issues in .NET7 on the ASP.NET Core repository.

The workaround I describe there requires modifying the application code so your pull request is probably a much better approach!

I'm just a bit worried that this project looks currently inactive. Last commit and last comment from @domaindrivendev dates back to January, 11. In the meantime, issues and pull requests are piling on. 😕 I hope this is only temporary. 🤞

Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.

@github-actions github-actions bot added the stale Stale issues or pull requests label Apr 14, 2024
@martincostello
Copy link
Collaborator

#2713 (comment)

@martincostello martincostello removed the stale Stale issues or pull requests label Apr 14, 2024
@martincostello martincostello self-assigned this May 14, 2024
@martincostello martincostello added this to the v6.6.2 milestone May 14, 2024
@martincostello
Copy link
Collaborator

Thanks for your help with this - the fix is available in Swashbuckle.AspNetCore 6.6.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants