8 implementations of IHostApplicationLifetime
Aspire.Hosting.Testing.Tests (1)
ResourceLoggerForwarderServiceTests.cs (1)
154private sealed class TestHostApplicationLifetime : IHostApplicationLifetime, IDisposable
Aspire.Hosting.Tests (4)
Cli\CliOrphanDetectorTests.cs (1)
283file sealed class HostLifetimeStub(Action stopImplementation) : IHostApplicationLifetime
Dashboard\DashboardLifecycleHookTests.cs (1)
658private sealed class TestHostApplicationLifetime : IHostApplicationLifetime
ResourceNotificationTests.cs (1)
732private sealed class TestHostApplicationLifetime : IHostApplicationLifetime, IDisposable
Utils\TestHostApplicationLifetime.cs (1)
8public sealed class TestHostApplicationLifetime : IHostApplicationLifetime
Microsoft.AspNetCore.Hosting (1)
Internal\ApplicationLifetime.cs (1)
17internal sealed class ApplicationLifetime : IApplicationLifetime, Extensions.Hosting.IApplicationLifetime, 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
84 references to IHostApplicationLifetime
Aspire.Hosting (11)
ApplicationModel\ResourceNotificationService.cs (4)
40/// Obsolete. Use the constructor that accepts an <see cref="ILogger{ResourceNotificationService}"/>, <see cref="IHostApplicationLifetime"/> and <see cref="IServiceProvider"/>.<br/> 47Use the constructor that accepts an {nameof(ILogger)}<{nameof(ResourceNotificationService)}>, {nameof(IHostApplicationLifetime)}, {nameof(IServiceProvider)} and {nameof(ResourceLoggerService)}. 50public ResourceNotificationService(ILogger<ResourceNotificationService> logger, IHostApplicationLifetime hostApplicationLifetime) 67IHostApplicationLifetime hostApplicationLifetime,
Backchannel\AppHostRpcTarget.cs (1)
19IHostApplicationLifetime lifetime,
Backchannel\AuxiliaryBackchannelRpcTarget.cs (2)
848var lifetime = serviceProvider.GetService<IHostApplicationLifetime>();
Cli\CliOrphanDetector.cs (1)
11internal sealed class CliOrphanDetector(IConfiguration configuration, IHostApplicationLifetime lifetime, TimeProvider timeProvider, ILogger<CliOrphanDetector> logger) : BackgroundService
Dashboard\DashboardEventHandlers.cs (1)
41IHostApplicationLifetime hostApplicationLifetime,
Dashboard\DashboardService.cs (1)
23internal sealed partial class DashboardService(DashboardServiceData serviceData, IHostEnvironment hostEnvironment, IHostApplicationLifetime hostApplicationLifetime, IConfiguration configuration, ILogger<DashboardService> logger)
Publishing\PipelineExecutor.cs (1)
20IHostApplicationLifetime lifetime,
Aspire.Hosting.RemoteHost (2)
OrphanDetector.cs (2)
13private readonly IHostApplicationLifetime _lifetime; 16public OrphanDetector(IHostApplicationLifetime lifetime, ILogger<OrphanDetector> logger)
Aspire.Hosting.Testing (6)
DistributedApplicationFactory.cs (4)
33private IHostApplicationLifetime? _hostApplicationLifetime; 428_hostApplicationLifetime = app.Services.GetService<IHostApplicationLifetime>() 429?? throw new InvalidOperationException($"Application did not register an implementation of {typeof(IHostApplicationLifetime)}."); 517static state => (state as IHostApplicationLifetime)?.StopApplication(),
DistributedApplicationHostingTestingExtensions.cs (2)
172var lifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
Aspire.Hosting.Testing.Tests (2)
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (2)
78var hostApplicationLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
Aspire.Hosting.Tests (6)
Backchannel\AuxiliaryBackchannelTests.cs (2)
415var lifetime = app.Services.GetService<IHostApplicationLifetime>();
Cli\CliOrphanDetectorTests.cs (1)
265IHostApplicationLifetime lifetime,
Utils\LoggerNotificationExtensions.cs (2)
78var hostApplicationLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
Utils\ResourceNotificationServiceTestHelpers.cs (1)
12public 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)
78var hostApplicationLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
DatabaseMigration.MigrationService (1)
ApiDbInitializer.cs (1)
15IHostApplicationLifetime hostApplicationLifetime) : BackgroundService
Microsoft.AspNetCore (3)
WebApplication.cs (3)
59public IHostApplicationLifetime Lifetime => _host.Services.GetRequiredService<IHostApplicationLifetime>(); 268public IHostApplicationLifetime Lifetime => _webApplication.Lifetime;
Microsoft.AspNetCore.Hosting (6)
GenericHost\GenericWebHostApplicationLifetime.cs (2)
11private readonly IHostApplicationLifetime _applicationLifetime; 12public GenericWebHostApplicationLifetime(IHostApplicationLifetime applicationLifetime)
Internal\WebHost.cs (1)
67_applicationServiceCollection.AddSingleton<IHostApplicationLifetime>(services
WebHostExtensions.cs (3)
154var applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 158((IHostApplicationLifetime)state!).StopApplication();
Microsoft.AspNetCore.Http.Connections (1)
Internal\HttpConnectionManager.cs (1)
30public HttpConnectionManager(ILoggerFactory loggerFactory, IHostApplicationLifetime appLifetime, IOptions<ConnectionOptions> connectionOptions, HttpConnectionsMetrics metrics)
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.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)
345/// Listens for Ctrl+C or SIGTERM and calls <see cref="IHostApplicationLifetime.StopApplication"/> to start the shutdown process. 360/// 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)
39IHostApplicationLifetime applicationLifetime, 495public IHostApplicationLifetime ApplicationLifetime => host._applicationLifetime;
Microsoft.Extensions.Hosting.Abstractions (8)
HostingAbstractionsHostExtensions.cs (3)
92IHostApplicationLifetime applicationLifetime = host.Services.GetRequiredService<IHostApplicationLifetime>(); 96((IHostApplicationLifetime)state!).StopApplication();
IApplicationLifetime.cs (4)
19/// <inheritdoc cref="IHostApplicationLifetime.ApplicationStarted" /> 22/// <inheritdoc cref="IHostApplicationLifetime.ApplicationStopping" /> 25/// <inheritdoc cref="IHostApplicationLifetime.ApplicationStopped" /> 28/// <inheritdoc cref="IHostApplicationLifetime.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; } 148/// Triggers <see cref="IHostApplicationLifetime.ApplicationStopping"/> and waits for <see cref="IHostApplicationLifetime.ApplicationStopped"/>. 164/// Triggers <see cref="IHostApplicationLifetime.ApplicationStopping"/> and waits for <see cref="IHostApplicationLifetime.ApplicationStopped"/>.