14 implementations of IHostApplicationLifetime
Aspire.Hosting.Testing.Tests (1)
ResourceLoggerForwarderServiceTests.cs (1)
137private sealed class TestHostApplicationLifetime : IHostApplicationLifetime, IDisposable
Aspire.Hosting.Tests (3)
Dashboard\DashboardLifecycleHookTests.cs (1)
182private sealed class TestHostApplicationLifetime : IHostApplicationLifetime
ResourceNotificationTests.cs (1)
393private sealed class TestHostApplicationLifetime : IHostApplicationLifetime, IDisposable
Utils\TestHostApplicationLifetime.cs (1)
8public sealed class TestHostApplicationLifetime : IHostApplicationLifetime
InMemory.FunctionalTests (1)
src\Servers\Kestrel\shared\test\LifetimeNotImplemented.cs (1)
10public class LifetimeNotImplemented : IHostApplicationLifetime
Microsoft.AspNetCore.Hosting (1)
Internal\ApplicationLifetime.cs (1)
17internal sealed class ApplicationLifetime : IApplicationLifetime, Extensions.Hosting.IApplicationLifetime, IHostApplicationLifetime
Microsoft.AspNetCore.Http.Connections.Tests (2)
ApplicationLifetime.cs (2)
10public class TestApplicationLifetime : IHostApplicationLifetime 33public class EmptyApplicationLifetime : IHostApplicationLifetime
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
src\Servers\Kestrel\shared\test\LifetimeNotImplemented.cs (1)
10public class LifetimeNotImplemented : IHostApplicationLifetime
Microsoft.AspNetCore.SpaServices.Extensions.Tests (1)
SpaServicesExtensionsTests.cs (1)
74private class TestHostApplicationLifetime : IHostApplicationLifetime
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (1)
MockHostApplicationLifetime.cs (1)
10internal class MockHostApplicationLifetime : IHostApplicationLifetime, IDisposable
Microsoft.Extensions.Hosting (1)
Internal\ApplicationLifetime.cs (1)
18public class ApplicationLifetime : IApplicationLifetime, IHostApplicationLifetime
Sockets.BindTests (1)
src\Servers\Kestrel\shared\test\LifetimeNotImplemented.cs (1)
10public class LifetimeNotImplemented : IHostApplicationLifetime
Sockets.FunctionalTests (1)
src\Servers\Kestrel\shared\test\LifetimeNotImplemented.cs (1)
10public class LifetimeNotImplemented : IHostApplicationLifetime
154 references to IHostApplicationLifetime
Aspire.Hosting (8)
ApplicationModel\ResourceNotificationService.cs (4)
32/// Obsolete. Use the constructor that accepts an <see cref="ILogger{ResourceNotificationService}"/>, <see cref="IHostApplicationLifetime"/> and <see cref="IServiceProvider"/>.<br/> 39Use the constructor that accepts an {nameof(ILogger)}<{nameof(ResourceNotificationService)}>, {nameof(IHostApplicationLifetime)}, {nameof(IServiceProvider)} and {nameof(ResourceLoggerService)}. 42public ResourceNotificationService(ILogger<ResourceNotificationService> logger, IHostApplicationLifetime hostApplicationLifetime) 57public ResourceNotificationService(ILogger<ResourceNotificationService> logger, IHostApplicationLifetime hostApplicationLifetime, IServiceProvider serviceProvider, ResourceLoggerService resourceLoggerService)
Dashboard\DashboardLifecycleHook.cs (1)
33IHostApplicationLifetime hostApplicationLifetime,
Dashboard\DashboardService.cs (1)
21internal sealed partial class DashboardService(DashboardServiceData serviceData, IHostEnvironment hostEnvironment, IHostApplicationLifetime hostApplicationLifetime, ILogger<DashboardService> logger)
Publishing\ManifestPublisher.cs (2)
14IHostApplicationLifetime lifetime, 19private readonly IHostApplicationLifetime _lifetime = lifetime;
Aspire.Hosting.Testing (6)
DistributedApplicationFactory.cs (4)
29private IHostApplicationLifetime? _hostApplicationLifetime; 286_hostApplicationLifetime = app.Services.GetService<IHostApplicationLifetime>() 287?? throw new InvalidOperationException($"Application did not register an implementation of {typeof(IHostApplicationLifetime)}."); 378static state => (state as IHostApplicationLifetime)?.StopApplication(),
DistributedApplicationHostingTestingExtensions.cs (2)
107var lifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
Aspire.Hosting.Testing.Tests (2)
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (2)
68var hostApplicationLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
Aspire.Hosting.Tests (6)
Helpers\JsonDocumentManifestPublisher.cs (1)
16IHostApplicationLifetime lifetime, DistributedApplicationExecutionContext executionContext
Helpers\NoopPublisher.cs (2)
8internal sealed class NoopPublisher(IHostApplicationLifetime lifetime) : IDistributedApplicationPublisher 10private readonly IHostApplicationLifetime _lifetime = lifetime;
Utils\LoggerNotificationExtensions.cs (2)
68var hostApplicationLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
Utils\ResourceNotificationServiceTestHelpers.cs (1)
12internal static ResourceNotificationService Create(ILogger<ResourceNotificationService>? logger = null, IHostApplicationLifetime? hostApplicationLifetime = null, ResourceLoggerService? resourceLoggerService = null)
Aspire.Playground.Tests (2)
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (2)
68var hostApplicationLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
DatabaseMigration.MigrationService (1)
ApiDbInitializer.cs (1)
15IHostApplicationLifetime hostApplicationLifetime) : BackgroundService
http2cat (2)
src\Shared\Http2cat\Http2CatHostedService.cs (2)
32IOptions<Http2CatOptions> options, IHostApplicationLifetime hostApplicationLifetime) 40public IHostApplicationLifetime HostApplicationLifetime { get; }
IIS.FunctionalTests (2)
src\Shared\Http2cat\Http2CatHostedService.cs (2)
32IOptions<Http2CatOptions> options, IHostApplicationLifetime hostApplicationLifetime) 40public IHostApplicationLifetime HostApplicationLifetime { get; }
IIS.LongTests (2)
src\Shared\Http2cat\Http2CatHostedService.cs (2)
32IOptions<Http2CatOptions> options, IHostApplicationLifetime hostApplicationLifetime) 40public IHostApplicationLifetime HostApplicationLifetime { get; }
IIS.NewHandler.FunctionalTests (2)
src\Shared\Http2cat\Http2CatHostedService.cs (2)
32IOptions<Http2CatOptions> options, IHostApplicationLifetime hostApplicationLifetime) 40public IHostApplicationLifetime HostApplicationLifetime { get; }
IIS.NewShim.FunctionalTests (2)
src\Shared\Http2cat\Http2CatHostedService.cs (2)
32IOptions<Http2CatOptions> options, IHostApplicationLifetime hostApplicationLifetime) 40public IHostApplicationLifetime HostApplicationLifetime { get; }
IIS.Tests (2)
Utilities\TestServer.cs (2)
166var lifetime = _host.Services.GetService<IHostApplicationLifetime>();
IISExpress.FunctionalTests (2)
src\Shared\Http2cat\Http2CatHostedService.cs (2)
32IOptions<Http2CatOptions> options, IHostApplicationLifetime hostApplicationLifetime) 40public IHostApplicationLifetime HostApplicationLifetime { get; }
InteropWebsite (1)
Startup.cs (1)
35public void Configure(IApplicationBuilder app, IHostApplicationLifetime applicationLifetime)
Microsoft.AspNetCore (3)
WebApplication.cs (3)
59public IHostApplicationLifetime Lifetime => _host.Services.GetRequiredService<IHostApplicationLifetime>(); 268public IHostApplicationLifetime Lifetime => _webApplication.Lifetime;
Microsoft.AspNetCore.Components.Server.Tests (1)
ComponentEndpointRouteBuilderExtensionsTest.cs (1)
131services.AddSingleton(Mock.Of<IHostApplicationLifetime>());
Microsoft.AspNetCore.Hosting (6)
GenericHost\GenericWebHostApplicationLifetime.cs (2)
11private readonly IHostApplicationLifetime _applicationLifetime; 12public GenericWebHostApplicationLifetime(IHostApplicationLifetime applicationLifetime)
Internal\WebHost.cs (1)
66_applicationServiceCollection.AddSingleton<IHostApplicationLifetime>(services
WebHostExtensions.cs (3)
154var applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 158((IHostApplicationLifetime)state!).StopApplication();
Microsoft.AspNetCore.Hosting.Tests (23)
WebHostBuilderTests.cs (1)
164var services = host.Services.GetServices<IHostApplicationLifetime>();
WebHostTests.cs (22)
163var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 315var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 409var applicationLifetime = host.Services.GetService<IHostApplicationLifetime>(); 430var applicationLifetime = host.Services.GetService<IHostApplicationLifetime>(); 508var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 531var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 555var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 598var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 651var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 680var applicationLifetime = host.Services.GetService<IHostApplicationLifetime>(); 1147private readonly IHostApplicationLifetime _lifetime; 1150public TestHostedService(IHostApplicationLifetime lifetime,
Microsoft.AspNetCore.Hosting.TestSites (1)
StartupShutdown.cs (1)
14public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostApplicationLifetime lifetime)
Microsoft.AspNetCore.Hosting.WindowsServices (1)
WebHostService.cs (1)
49.GetRequiredService<IHostApplicationLifetime>()
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (4)
WebHostServiceTests.cs (4)
24var applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 38var applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>();
Microsoft.AspNetCore.Http.Connections (1)
Internal\HttpConnectionManager.cs (1)
30public HttpConnectionManager(ILoggerFactory loggerFactory, IHostApplicationLifetime appLifetime, IOptions<ConnectionOptions> connectionOptions, HttpConnectionsMetrics metrics)
Microsoft.AspNetCore.Http.Connections.Tests (1)
HttpConnectionManagerTests.cs (1)
428private static HttpConnectionManager CreateConnectionManager(ILoggerFactory loggerFactory, IHostApplicationLifetime lifetime = null, HttpConnectionsMetrics metrics = null)
Microsoft.AspNetCore.Mvc.FunctionalTests (3)
TestingInfrastructureInheritanceTests.cs (3)
73var lifetimeService = (IHostApplicationLifetime)factory.Services.GetService(typeof(IHostApplicationLifetime));
Microsoft.AspNetCore.Mvc.Testing (1)
DeferredHostBuilder.cs (1)
152using var reg2 = _host.Services.GetRequiredService<IHostApplicationLifetime>().ApplicationStarted.UnsafeRegister(_ => _hostStartedTcs.TrySetResult(), null);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (2)
src\Shared\Http2cat\Http2CatHostedService.cs (2)
32IOptions<Http2CatOptions> options, IHostApplicationLifetime hostApplicationLifetime) 40public IHostApplicationLifetime HostApplicationLifetime { get; }
Microsoft.AspNetCore.Server.IIS (2)
Core\IISHttpServer.cs (2)
26private readonly IHostApplicationLifetime _applicationLifetime; 60IHostApplicationLifetime applicationLifetime,
Microsoft.AspNetCore.Server.IISIntegration (5)
IISMiddleware.cs (5)
35private readonly IHostApplicationLifetime _applicationLifetime; 46/// <param name="applicationLifetime">The <see cref="IHostApplicationLifetime"/>.</param> 53IHostApplicationLifetime applicationLifetime) 67/// <param name="applicationLifetime">The <see cref="IHostApplicationLifetime"/>.</param> 74IHostApplicationLifetime applicationLifetime)
Microsoft.AspNetCore.Server.IISIntegration.Tests (8)
IISMiddlewareTests.cs (8)
117var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>(); 176var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>(); 221var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>(); 266var appLifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>();
Microsoft.AspNetCore.SignalR.Tests.Utils (2)
src\Shared\SignalR\InProcessTestServer.cs (2)
41private IHostApplicationLifetime _lifetime; 131_lifetime = _host.Services.GetRequiredService<IHostApplicationLifetime>();
Microsoft.AspNetCore.SpaProxy (5)
SpaProxyLaunchManager.cs (1)
25IHostApplicationLifetime appLifetime,
SpaProxyMiddleware.cs (2)
27private readonly IHostApplicationLifetime _hostLifetime; 34IHostApplicationLifetime hostLifetime,
SpaProxyStartupFilter.cs (2)
14private readonly IHostApplicationLifetime _hostLifetime; 19IHostApplicationLifetime hostLifetime,
Microsoft.AspNetCore.SpaServices.Extensions (6)
AngularCli\AngularCliBuilder.cs (1)
49var applicationStoppingToken = appBuilder.ApplicationServices.GetRequiredService<IHostApplicationLifetime>().ApplicationStopping;
AngularCli\AngularCliMiddleware.cs (1)
38var applicationStoppingToken = appBuilder.ApplicationServices.GetRequiredService<IHostApplicationLifetime>().ApplicationStopping;
Proxying\ConditionalProxyMiddleware.cs (1)
28IHostApplicationLifetime applicationLifetime)
Proxying\SpaProxyingExtensions.cs (2)
84var applicationLifetime = appBuilder 86.GetRequiredService<IHostApplicationLifetime>();
ReactDevelopmentServer\ReactDevelopmentServerMiddleware.cs (1)
38var applicationStoppingToken = appBuilder.ApplicationServices.GetRequiredService<IHostApplicationLifetime>().ApplicationStopping;
Microsoft.AspNetCore.SpaServices.Extensions.Tests (1)
SpaServicesExtensionsTests.cs (1)
62services.AddSingleton(typeof(IHostApplicationLifetime), new TestHostApplicationLifetime());
Microsoft.AspNetCore.Tests (1)
WebApplicationTests.cs (1)
2422Assert.Contains(builder.Services, service => service.ServiceType == typeof(IHostApplicationLifetime));
Microsoft.Extensions.Diagnostics.HealthChecks.Common (3)
ApplicationLifecycleHealthCheck.cs (3)
11/// Health check which considers the application healthy after it is reported as started by <see cref="IHostApplicationLifetime" /> 20private readonly IHostApplicationLifetime _appLifetime; 26public ApplicationLifecycleHealthCheck(IHostApplicationLifetime appLifetime)
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (6)
ApplicationLifecycleHealthChecksExtensionsTests.cs (6)
20serviceCollection.AddSingleton<IHostApplicationLifetime>(new Mock<IHostApplicationLifetime>().Object); 30serviceCollection.AddSingleton<IHostApplicationLifetime>(new Mock<IHostApplicationLifetime>().Object); 40serviceCollection.AddSingleton<IHostApplicationLifetime>(new Mock<IHostApplicationLifetime>().Object);
Microsoft.Extensions.Hosting (10)
HostBuilder.cs (3)
308services.AddSingleton(s => (IApplicationLifetime)s.GetRequiredService<IHostApplicationLifetime>()); 310services.AddSingleton<IHostApplicationLifetime, ApplicationLifetime>(); 323appServices.GetRequiredService<IHostApplicationLifetime>(),
HostingHostBuilderExtensions.cs (2)
336/// Listens for Ctrl+C or SIGTERM and calls <see cref="IHostApplicationLifetime.StopApplication"/> to start the shutdown process. 351/// Listens for Ctrl+C or SIGTERM and calls <see cref="IHostApplicationLifetime.StopApplication"/> to start the shutdown process.
Internal\ConsoleLifetime.cs (3)
34public ConsoleLifetime(IOptions<ConsoleLifetimeOptions> options, IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, IOptions<HostOptions> hostOptions) 46public ConsoleLifetime(IOptions<ConsoleLifetimeOptions> options, IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, IOptions<HostOptions> hostOptions, ILoggerFactory loggerFactory) 65private IHostApplicationLifetime ApplicationLifetime { get; }
Internal\Host.cs (2)
37IHostApplicationLifetime applicationLifetime, 452public IHostApplicationLifetime ApplicationLifetime => host._applicationLifetime;
Microsoft.Extensions.Hosting.Abstractions (4)
HostingAbstractionsHostExtensions.cs (3)
92IHostApplicationLifetime applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 96((IHostApplicationLifetime)state!).StopApplication();
IHost.cs (1)
22/// The application will run until interrupted or until <see cref="IHostApplicationLifetime.StopApplication" /> is called.
Microsoft.Extensions.Hosting.Systemd (3)
SystemdLifetime.cs (3)
29/// <param name="applicationLifetime">The <see cref="IHostApplicationLifetime"/> that tracks the service lifetime.</param> 32public SystemdLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ISystemdNotifier systemdNotifier, ILoggerFactory loggerFactory) 45private IHostApplicationLifetime ApplicationLifetime { get; }
Microsoft.Extensions.Hosting.WindowsServices (9)
WindowsServiceLifetime.cs (9)
30/// <param name="applicationLifetime">The <see cref="IHostApplicationLifetime"/> that tracks the service lifetime.</param> 33public WindowsServiceLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory, IOptions<HostOptions> optionsAccessor) 42/// <param name="applicationLifetime">The <see cref="IHostApplicationLifetime"/> that tracks the service lifetime.</param> 46public WindowsServiceLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory, IOptions<HostOptions> optionsAccessor, IOptions<WindowsServiceLifetimeOptions> windowsServiceOptionsAccessor) 62private IHostApplicationLifetime ApplicationLifetime { get; } 145/// Triggers <see cref="IHostApplicationLifetime.ApplicationStopping"/> and waits for <see cref="IHostApplicationLifetime.ApplicationStopped"/>. 161/// Triggers <see cref="IHostApplicationLifetime.ApplicationStopping"/> and waits for <see cref="IHostApplicationLifetime.ApplicationStopped"/>.
Sockets.BindTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (1)
137services.AddSingleton<IHostApplicationLifetime, LifetimeNotImplemented>();
Sockets.FunctionalTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (1)
137services.AddSingleton<IHostApplicationLifetime, LifetimeNotImplemented>();