From e717c6245b53af52730d6188660f85fd6fe97c97 Mon Sep 17 00:00:00 2001 From: Simnico99 Date: Wed, 11 Jan 2023 09:22:46 -0500 Subject: [PATCH] Testing again. --- src/ZirconNet.WPF/Hosting/Lifetime/UseWpfApplicationLifetime.cs | 2 ++ .../Hosting/Lifetime/WpfApplicationLifetimeOptions.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ZirconNet.WPF/Hosting/Lifetime/UseWpfApplicationLifetime.cs b/src/ZirconNet.WPF/Hosting/Lifetime/UseWpfApplicationLifetime.cs index 6972a18..50ffca7 100644 --- a/src/ZirconNet.WPF/Hosting/Lifetime/UseWpfApplicationLifetime.cs +++ b/src/ZirconNet.WPF/Hosting/Lifetime/UseWpfApplicationLifetime.cs @@ -72,6 +72,8 @@ private async static Task RunWpfApplicationAsyncInternal(IHostBuilder builder using var host = builder.Build(); var window = host.Services.GetRequiredService(); + var applicationLifetime = host.Services.GetRequiredService(); + applicationLifetime.ApplicationStopped.Register(() => host?.Dispose()); await host.StartAsync(cancellationToken); await window.ShowDialogAsync(); diff --git a/src/ZirconNet.WPF/Hosting/Lifetime/WpfApplicationLifetimeOptions.cs b/src/ZirconNet.WPF/Hosting/Lifetime/WpfApplicationLifetimeOptions.cs index 2e9229d..9bf550b 100644 --- a/src/ZirconNet.WPF/Hosting/Lifetime/WpfApplicationLifetimeOptions.cs +++ b/src/ZirconNet.WPF/Hosting/Lifetime/WpfApplicationLifetimeOptions.cs @@ -1,5 +1,5 @@ namespace ZirconNet.WPF.Hosting.Lifetime; -public class WpfApplicationLifetimeOptions +public sealed class WpfApplicationLifetimeOptions { /// /// Indicates if host lifetime status messages should be suppressed such as on startup.