diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs index 4e9a62d53b9a8..d8172e9b61659 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs @@ -36,6 +36,7 @@ public abstract class BackgroundService : IHostedService, IDisposable /// Triggered when the application host is ready to start the service. /// /// Indicates that the start process has been aborted. + /// A that represents the asynchronous Start operation. public virtual Task StartAsync(CancellationToken cancellationToken) { // Create linked token to allow cancelling executing task from provided token @@ -58,6 +59,7 @@ public virtual Task StartAsync(CancellationToken cancellationToken) /// Triggered when the application host is performing a graceful shutdown. /// /// Indicates that the shutdown process should no longer be graceful. + /// A that represents the asynchronous Stop operation. public virtual async Task StopAsync(CancellationToken cancellationToken) { // Stop called without start diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/Environments.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/Environments.cs index 93b762e12c9a9..30ea295c3c721 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/Environments.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/Environments.cs @@ -8,8 +8,20 @@ namespace Microsoft.Extensions.Hosting /// public static class Environments { + /// + /// Specifies the Development environment. + /// + /// The development environment can enable features that shouldn't be exposed in production. Because of the performance cost, scope validation and dependency validation only happens in development. public static readonly string Development = "Development"; + /// + /// Specifies the Staging environment. + /// + /// The staging environment can be used to validate app changes before changing the environment to production. public static readonly string Staging = "Staging"; + /// + /// Specifies the Production environment. + /// + /// The production environment should be configured to maximize security, performance, and application robustness. public static readonly string Production = "Production"; } } diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostBuilderContext.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostBuilderContext.cs index 10d05076102bf..85e6f95a79c94 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostBuilderContext.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostBuilderContext.cs @@ -12,6 +12,10 @@ namespace Microsoft.Extensions.Hosting /// public class HostBuilderContext { + /// + /// Initializes a new instance of . + /// + /// A non-null for sharing state between components during the host building process. public HostBuilderContext(IDictionary properties) { ThrowHelper.ThrowIfNull(properties); diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostBuilderExtensions.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostBuilderExtensions.cs index 5e7f334993e76..f1cefed444d67 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostBuilderExtensions.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostBuilderExtensions.cs @@ -6,6 +6,9 @@ namespace Microsoft.Extensions.Hosting { + /// + /// Provides extension methods for the from the hosting abstractions package. + /// public static class HostingAbstractionsHostBuilderExtensions { /// diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostExtensions.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostExtensions.cs index 81484d28223ad..b0dd81dbe1935 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostExtensions.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostExtensions.cs @@ -8,6 +8,9 @@ namespace Microsoft.Extensions.Hosting { + /// + /// Provides extension methods for the from the hosting abstractions package. + /// public static class HostingAbstractionsHostExtensions { /// diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostBuilder.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostBuilder.cs index 7c08dd33014c1..faf77e945ce39 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostBuilder.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostBuilder.cs @@ -57,6 +57,7 @@ public interface IHostBuilder /// Overrides the factory used to create the service provider. /// /// The type of builder. + /// The factory to register. /// The same instance of the for chaining. IHostBuilder UseServiceProviderFactory(Func> factory) where TContainerBuilder : notnull; diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostLifetime.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostLifetime.cs index 5820904fc095f..2f8aa1202bf63 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostLifetime.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostLifetime.cs @@ -6,6 +6,9 @@ namespace Microsoft.Extensions.Hosting { + /// + /// Tracks host lifetime. + /// public interface IHostLifetime { /// diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostedService.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostedService.cs index 97a947b72513f..0bb8c07c22d77 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostedService.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostedService.cs @@ -15,12 +15,14 @@ public interface IHostedService /// Triggered when the application host is ready to start the service. /// /// Indicates that the start process has been aborted. + /// A that represents the asynchronous Start operation. Task StartAsync(CancellationToken cancellationToken); /// /// Triggered when the application host is performing a graceful shutdown. /// /// Indicates that the shutdown process should no longer be graceful. + /// A that represents the asynchronous Stop operation. Task StopAsync(CancellationToken cancellationToken); } } diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ISystemdNotifier.cs b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ISystemdNotifier.cs index 9f35b4f2112b7..bcfbb59db5f96 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ISystemdNotifier.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ISystemdNotifier.cs @@ -11,6 +11,7 @@ public interface ISystemdNotifier /// /// Sends a notification to systemd. /// + /// The to notify. void Notify(ServiceState state); /// /// Returns whether systemd is configured to receive service notifications. diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ServiceState.cs b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ServiceState.cs index 17270278e6f11..3fff525a64651 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ServiceState.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ServiceState.cs @@ -26,6 +26,7 @@ public struct ServiceState /// /// Create custom ServiceState. /// + /// A representation of service state. public ServiceState(string state) { ThrowHelper.ThrowIfNull(state); @@ -36,6 +37,7 @@ public ServiceState(string state) /// /// String representation of service state. /// + /// The representation of the service state. public override string ToString() => _data == null ? string.Empty : Encoding.UTF8.GetString(_data); diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs index ae1ce1e903f0a..e1b196fb2a6f5 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs @@ -9,6 +9,9 @@ namespace Microsoft.Extensions.Hosting.Systemd { + /// + /// Provides notification messages for application started and stopping, and configures console logging to the systemd format. + /// [UnsupportedOSPlatform("android")] [UnsupportedOSPlatform("browser")] [UnsupportedOSPlatform("ios")] @@ -19,6 +22,13 @@ public partial class SystemdLifetime : IHostLifetime, IDisposable private CancellationTokenRegistration _applicationStartedRegistration; private CancellationTokenRegistration _applicationStoppingRegistration; + /// + /// Initializes a new instance. + /// + /// Information about the host. + /// The that tracks the service lifetime. + /// The to notify Systemd about service status. + /// The used to instantiate the lifetime logger. public SystemdLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ISystemdNotifier systemdNotifier, ILoggerFactory loggerFactory) { ThrowHelper.ThrowIfNull(environment); diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs index 715db9b04cab6..bfde5fe73df6a 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdNotifier.cs @@ -14,6 +14,9 @@ public class SystemdNotifier : ISystemdNotifier private readonly string? _socketPath; + /// + /// Instantiates a new and sets the notify socket path. + /// public SystemdNotifier() : this(GetNotifySocketPath()) { } diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs index 164e60670fb67..d39ddd818099b 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs @@ -11,6 +11,9 @@ namespace Microsoft.Extensions.Hosting.WindowsServices { + /// + /// Listens for shutdown signal and tracks the status of the Windows service. + /// [SupportedOSPlatform("windows")] public class WindowsServiceLifetime : ServiceBase, IHostLifetime { @@ -18,11 +21,26 @@ public class WindowsServiceLifetime : ServiceBase, IHostLifetime private readonly ManualResetEventSlim _delayStop = new ManualResetEventSlim(); private readonly HostOptions _hostOptions; + /// + /// Initializes a new instance. + /// + /// Information about the host. + /// The that tracks the service lifetime. + /// The used to instantiate the lifetime logger. + /// The containing options for the service. public WindowsServiceLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory, IOptions optionsAccessor) : this(environment, applicationLifetime, loggerFactory, optionsAccessor, Options.Options.Create(new WindowsServiceLifetimeOptions())) { } + /// + /// Initializes a new instance of the class. + /// + /// Information about the host. + /// The that tracks the service lifetime. + /// The used to instantiate the lifetime logger. + /// The containing options for the service. + /// The Windows service options used to find the service name. public WindowsServiceLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory, IOptions optionsAccessor, IOptions windowsServiceOptionsAccessor) { ThrowHelper.ThrowIfNull(environment); @@ -85,14 +103,17 @@ public Task StopAsync(CancellationToken cancellationToken) } // Called by base.Run when the service is ready to start. + /// protected override void OnStart(string[] args) { _delayStart.TrySetResult(null); base.OnStart(args); } - // Called by base.Stop. This may be called multiple times by service Stop, ApplicationStopping, and StopAsync. - // That's OK because StopApplication uses a CancellationTokenSource and prevents any recursion. + /// + /// Raises the Stop event to stop the . + /// + /// This might be called multiple times by service Stop, ApplicationStopping, and StopAsync. That's okay because StopApplication uses a CancellationTokenSource and prevents any recursion. protected override void OnStop() { ApplicationLifetime.StopApplication(); @@ -101,6 +122,9 @@ protected override void OnStop() base.OnStop(); } + /// + /// Raises the Shutdown event. + /// protected override void OnShutdown() { ApplicationLifetime.StopApplication(); @@ -109,6 +133,10 @@ protected override void OnShutdown() base.OnShutdown(); } + /// + /// Releases the resources used by the . + /// + /// only when called from ; otherwise, . protected override void Dispose(bool disposing) { if (disposing) diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/ConsoleLifetimeOptions.cs b/src/libraries/Microsoft.Extensions.Hosting/src/ConsoleLifetimeOptions.cs index eebb5d7fae165..90366bd82f199 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/ConsoleLifetimeOptions.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/ConsoleLifetimeOptions.cs @@ -3,6 +3,9 @@ namespace Microsoft.Extensions.Hosting { + /// + /// Provides option flags for . + /// public class ConsoleLifetimeOptions { /// diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs index a285d3e487ef7..aca18778f3f7e 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs @@ -38,6 +38,9 @@ public partial class HostBuilder : IHostBuilder private IServiceProvider? _appServices; private PhysicalFileProvider? _defaultProvider; + /// + /// Initializes a new instance of . + /// [RequiresDynamicCode(Host.RequiresDynamicCodeMessage)] public HostBuilder() { diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs index 33ab570a2f1ff..ad09104a153ce 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs @@ -18,6 +18,9 @@ namespace Microsoft.Extensions.Hosting { + /// + /// Provides extension methods for the from the hosting package. + /// public static class HostingHostBuilderExtensions { /// @@ -64,7 +67,7 @@ public static IHostBuilder UseContentRoot(this IHostBuilder hostBuilder, string /// Specify the to be the default one. /// /// The to configure. - /// + /// The delegate that configures the . /// The . [RequiresDynamicCode(Host.RequiresDynamicCodeMessage)] public static IHostBuilder UseDefaultServiceProvider(this IHostBuilder hostBuilder, Action configure) @@ -161,7 +164,7 @@ public static IHostBuilder ConfigureServices(this IHostBuilder hostBuilder, Acti /// Enables configuring the instantiated dependency container. This can be called multiple times and /// the results will be additive. /// - /// + /// The type of builder. /// The to configure. /// The delegate for configuring the . /// The same instance of the for chaining.