From fc3d87a8ccc6116ae2ebfd11b4a36dbd261dbf70 Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Fri, 24 Dec 2021 15:32:09 +0100 Subject: [PATCH 01/13] HostBuilder.Build doc: mention lifetime Mention that the host application lifetime service will be added *in addition* to the services configured to be run. --- src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs index 3827761382a135..60f262bae94acf 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs @@ -119,6 +119,8 @@ public IHostBuilder ConfigureContainer(Action /// Run the given actions to initialize the host. This can only be called once. + /// Adds host application lifetime service to the host. + /// The application will run until interrupted or until is called. /// /// An initialized public IHost Build() From 7590e677ba8a2e053dcfc0af01c1d472f932f524 Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Tue, 4 Jan 2022 19:03:05 +0100 Subject: [PATCH 02/13] ExecuteAsync: See Worker Services in .NET --- .../src/BackgroundService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs index 5e736c11fb8a78..30dcb02bac88ef 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs @@ -28,6 +28,7 @@ public abstract class BackgroundService : IHostedService, IDisposable /// the lifetime of the long running operation(s) being performed. /// /// Triggered when is called. + /// See Worker Services in .NET for implementation guidelines. /// A that represents the long running operations. protected abstract Task ExecuteAsync(CancellationToken stoppingToken); From bf09e4f0f55675346ac72bdeecf3acb28596ccc3 Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Tue, 4 Jan 2022 19:16:00 +0100 Subject: [PATCH 03/13] StartAsync: mention IHostApplicationLifetime 1. The application will run until interrupted or until `HostApplicationLifetime.StopApplication()` is called. 2. Document how to configure `Services`. --- .../Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs index b0f2d86546d8e0..a115098bdce8eb 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs @@ -13,12 +13,13 @@ namespace Microsoft.Extensions.Hosting public interface IHost : IDisposable { /// - /// The programs configured services. + /// The services configured for the program (e.g. using ). /// IServiceProvider Services { get; } /// - /// Start the program. + /// Start the configured for the program. + /// The application will run until interrupted or until is called. /// /// Used to abort program start. /// A that will be completed when the starts. From 77b53ae99ecebb1d5ee04bfb582cccf5298a0313 Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Tue, 4 Jan 2022 19:17:13 +0100 Subject: [PATCH 04/13] mv mention StopApplication to StartAsync Co-authored-by: Eric Erhardt --- src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs index 60f262bae94acf..150499cae5b78c 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs @@ -120,7 +120,6 @@ public IHostBuilder ConfigureContainer(Action /// Run the given actions to initialize the host. This can only be called once. /// Adds host application lifetime service to the host. - /// The application will run until interrupted or until is called. /// /// An initialized public IHost Build() From c978b6b9c8f747ab99f4896a2ab6c0bfa25abd2e Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Tue, 4 Jan 2022 19:20:04 +0100 Subject: [PATCH 05/13] Build doc: mv services to remarks --- src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs index 150499cae5b78c..5130b011de6b4c 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs @@ -119,9 +119,9 @@ public IHostBuilder ConfigureContainer(Action /// Run the given actions to initialize the host. This can only be called once. - /// Adds host application lifetime service to the host. /// /// An initialized + /// Adds basic services to the host such as application lifetime, host environment and logging. public IHost Build() { if (_hostBuilt) From 2d91f7e2baeed32d61a9f1033cd5edc844c187ab Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Tue, 4 Jan 2022 19:55:09 +0100 Subject: [PATCH 06/13] typo fix --- .../Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs index a115098bdce8eb..bf06dee06be1fe 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs @@ -13,7 +13,7 @@ namespace Microsoft.Extensions.Hosting public interface IHost : IDisposable { /// - /// The services configured for the program (e.g. using ). + /// The services configured for the program (e.g. using ). /// IServiceProvider Services { get; } From 1c842a032e792d511cb78cf24d4f96e5fff9cc4a Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Wed, 5 Jan 2022 17:54:22 +0100 Subject: [PATCH 07/13] Starts only hosted services Co-authored-by: Eric Erhardt --- .../Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs index bf06dee06be1fe..755b0a6dd344f8 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs @@ -18,7 +18,7 @@ public interface IHost : IDisposable IServiceProvider Services { get; } /// - /// Start the configured for the program. + /// Start the objects configured for the program. /// The application will run until interrupted or until is called. /// /// Used to abort program start. From 073205adf70b615b5771ff00a9c7f89d39378250 Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Wed, 5 Jan 2022 18:30:32 +0100 Subject: [PATCH 08/13] See see --- .../src/BackgroundService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs index 30dcb02bac88ef..cfcd4195328d44 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs @@ -28,7 +28,7 @@ public abstract class BackgroundService : IHostedService, IDisposable /// the lifetime of the long running operation(s) being performed. /// /// Triggered when is called. - /// See Worker Services in .NET for implementation guidelines. + /// See Worker Services in .NET for implementation guidelines. /// A that represents the long running operations. protected abstract Task ExecuteAsync(CancellationToken stoppingToken); From 9f8fa94a229015e07774149f2f4f28591c84ce0a Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Wed, 5 Jan 2022 18:31:20 +0100 Subject: [PATCH 09/13] IHost.Services are RO Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs index 755b0a6dd344f8..618f5222ee0b09 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs @@ -13,7 +13,7 @@ namespace Microsoft.Extensions.Hosting public interface IHost : IDisposable { /// - /// The services configured for the program (e.g. using ). + /// Gets the services configured for the program (for example, using ). /// IServiceProvider Services { get; } From 23d1febf6e854bde6570b48280fbbf58864db0c2 Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Wed, 5 Jan 2022 18:31:54 +0100 Subject: [PATCH 10/13] Use indicative Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs index 618f5222ee0b09..339037f317a5e0 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHost.cs @@ -18,7 +18,7 @@ public interface IHost : IDisposable IServiceProvider Services { get; } /// - /// Start the objects configured for the program. + /// Starts the objects configured for the program. /// The application will run until interrupted or until is called. /// /// Used to abort program start. From a0e31e9c384ebf1d61fdf45edaa9ff381d7256e8 Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Wed, 5 Jan 2022 18:32:47 +0100 Subject: [PATCH 11/13] Oxford commas Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs index 5130b011de6b4c..5f0ad5f68d5244 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs @@ -121,7 +121,7 @@ public IHostBuilder ConfigureContainer(Action /// An initialized - /// Adds basic services to the host such as application lifetime, host environment and logging. + /// Adds basic services to the host such as application lifetime, host environment, and logging. public IHost Build() { if (_hostBuilt) From 20f559fcd4f83b620a19a40472569430d6ba64c3 Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Wed, 5 Jan 2022 18:49:07 +0100 Subject: [PATCH 12/13] see in remarks --- .../src/BackgroundService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs index cfcd4195328d44..fd7840aae996a2 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs @@ -28,8 +28,9 @@ public abstract class BackgroundService : IHostedService, IDisposable /// the lifetime of the long running operation(s) being performed. /// /// Triggered when is called. - /// See Worker Services in .NET for implementation guidelines. /// A that represents the long running operations. + /// See Worker Services in .NET for implementation guidelines. + protected abstract Task ExecuteAsync(CancellationToken stoppingToken); /// From f1900e4581c67760ca7fff213a914c368b64ea96 Mon Sep 17 00:00:00 2001 From: Christopher Yeleighton Date: Wed, 5 Jan 2022 18:53:14 +0100 Subject: [PATCH 13/13] typo fix Co-authored-by: Eric Erhardt --- .../src/BackgroundService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs index fd7840aae996a2..f7802124ea60e6 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs @@ -30,7 +30,6 @@ public abstract class BackgroundService : IHostedService, IDisposable /// Triggered when is called. /// A that represents the long running operations. /// See Worker Services in .NET for implementation guidelines. - protected abstract Task ExecuteAsync(CancellationToken stoppingToken); ///