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

Host lifetime events not honored. #7240

Open
1 task done
Expecho opened this issue Jan 24, 2025 · 2 comments
Open
1 task done

Host lifetime events not honored. #7240

Expecho opened this issue Jan 24, 2025 · 2 comments
Labels
area-tooling untriaged New issue has not been triaged

Comments

@Expecho
Copy link

Expecho commented Jan 24, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I noticed that when a .net web api is started using Aspire the app host lifetime signals ( IHostApplicationLifetime) are not coming through when the app host is stopped or the api is stopped using the dashboard.

In my .net web api project I have code like this in the Program.cs:

app.Lifetime.ApplicationStopping.Register(() =>
{
   // some code
});

Expected Behavior

I expect the code to be executed when the AppHost is shutdown using for example [CTRL] + [C].
I also expect the code to be executed when to Stop command is issued through the built-in Aspire dashboard.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version info

No response

Anything else?

No response

@davidfowl
Copy link
Member

@Expecho are you using visual studio or dotnet run?

@Expecho
Copy link
Author

Expecho commented Jan 24, 2025

Visual Studio

@davidfowl davidfowl added area-tooling untriaged New issue has not been triaged labels Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-tooling untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

2 participants