Open xperiandri opened 3 months ago
So after I implemented it like this
public class UnoHostApplicationLifetime : ApplicationLifetime, IHostApplicationLifetime
{
public UnoHostApplicationLifetime(ILogger<ApplicationLifetime> logger) : base(logger) { }
CancellationToken IHostApplicationLifetime.ApplicationStarted => this.ApplicationStarted;
CancellationToken IHostApplicationLifetime.ApplicationStopping => this.ApplicationStopping;
CancellationToken IHostApplicationLifetime.ApplicationStopped => this.ApplicationStopped;
void IHostApplicationLifetime.StopApplication()
{
this.StopApplication();
Environment.Exit(0);
}
}
the app closes, however after the main screen opens even though the hosted service calling StopApplication
is the first one in the list
Current behavior
Expected behavior
As Uno Platform uses generic host it is expected to respect its lifetime management. However
IHostApplicationLifetime.StopApplication()
does not quit the app but opens and empty page.How to reproduce it (as minimally and precisely as possible)
Create a hosted service Inject
IHostApplicationLifetime
CallStopApplication()
in theStartAsync
method See a blank windowEnvironment
Nuget Package (s):
Uno.Extentions.Navigation.UI
Package Version(s):
4.1.24
Affected platform(s):
Visual Studio:
Anything else we need to know?
See https://github.com/kevinchalet/openiddict-core/blob/maui_winui_sample/sandbox/OpenIddict.Sandbox.Maui.Client/MauiHostApplicationLifetime.cs#L18 and https://github.com/kevinchalet/openiddict-core/blob/8a9bb17553f587f3b63002f9e40873f95c203f8a/sandbox/OpenIddict.Sandbox.Maui.Client/MauiProgram.cs#L110