Skip to content

Commit 2eee1ca

Browse files
API Debt - Microsoft.Extensions.Hosting (#76692)
* Triple slash for Extensions.Hosting * Add Extensions.Hosting.Systemd triple-slash * Add Extensions.Hosting.WindowsService triple-slash * Resolve feedback. Asynchronous is hard to spell. * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> * Resolve feedback to match conventions * Update src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs Co-authored-by: Genevieve Warren <[email protected]> * Address feedback and resolve missing classes Co-authored-by: Genevieve Warren <[email protected]>
1 parent 8a9ca1a commit 2eee1ca

File tree

16 files changed

+87
-4
lines changed

16 files changed

+87
-4
lines changed

src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/BackgroundService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public abstract class BackgroundService : IHostedService, IDisposable
3636
/// Triggered when the application host is ready to start the service.
3737
/// </summary>
3838
/// <param name="cancellationToken">Indicates that the start process has been aborted.</param>
39+
/// <returns>A <see cref="Task"/> that represents the asynchronous Start operation.</returns>
3940
public virtual Task StartAsync(CancellationToken cancellationToken)
4041
{
4142
// Create linked token to allow cancelling executing task from provided token
@@ -58,6 +59,7 @@ public virtual Task StartAsync(CancellationToken cancellationToken)
5859
/// Triggered when the application host is performing a graceful shutdown.
5960
/// </summary>
6061
/// <param name="cancellationToken">Indicates that the shutdown process should no longer be graceful.</param>
62+
/// <returns>A <see cref="Task"/> that represents the asynchronous Stop operation.</returns>
6163
public virtual async Task StopAsync(CancellationToken cancellationToken)
6264
{
6365
// Stop called without start

src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/Environments.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,20 @@ namespace Microsoft.Extensions.Hosting
88
/// </summary>
99
public static class Environments
1010
{
11+
/// <summary>
12+
/// Specifies the Development environment.
13+
/// </summary>
14+
/// <remarks>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.</remarks>
1115
public static readonly string Development = "Development";
16+
/// <summary>
17+
/// Specifies the Staging environment.
18+
/// </summary>
19+
/// <remarks>The staging environment can be used to validate app changes before changing the environment to production.</remarks>
1220
public static readonly string Staging = "Staging";
21+
/// <summary>
22+
/// Specifies the Production environment.
23+
/// </summary>
24+
/// <remarks>The production environment should be configured to maximize security, performance, and application robustness.</remarks>
1325
public static readonly string Production = "Production";
1426
}
1527
}

src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostBuilderContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ namespace Microsoft.Extensions.Hosting
1212
/// </summary>
1313
public class HostBuilderContext
1414
{
15+
/// <summary>
16+
/// Initializes a new instance of <see cref="HostBuilderContext"/>.
17+
/// </summary>
18+
/// <param name="properties">A non-null <see cref="IDictionary{TKey, TValue}"/> for sharing state between components during the host building process.</param>
1519
public HostBuilderContext(IDictionary<object, object> properties)
1620
{
1721
ThrowHelper.ThrowIfNull(properties);

src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostBuilderExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Microsoft.Extensions.Hosting
88
{
9+
/// <summary>
10+
/// Provides extension methods for the <see cref="IHostBuilder"/> from the hosting abstractions package.
11+
/// </summary>
912
public static class HostingAbstractionsHostBuilderExtensions
1013
{
1114
/// <summary>

src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostingAbstractionsHostExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
namespace Microsoft.Extensions.Hosting
1010
{
11+
/// <summary>
12+
/// Provides extension methods for the <see cref="IHost"/> from the hosting abstractions package.
13+
/// </summary>
1114
public static class HostingAbstractionsHostExtensions
1215
{
1316
/// <summary>

src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostBuilder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public interface IHostBuilder
5757
/// Overrides the factory used to create the service provider.
5858
/// </summary>
5959
/// <typeparam name="TContainerBuilder">The type of builder.</typeparam>
60+
/// <param name="factory">The factory to register.</param>
6061
/// <returns>The same instance of the <see cref="IHostBuilder"/> for chaining.</returns>
6162
IHostBuilder UseServiceProviderFactory<TContainerBuilder>(Func<HostBuilderContext, IServiceProviderFactory<TContainerBuilder>> factory) where TContainerBuilder : notnull;
6263

src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostLifetime.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Microsoft.Extensions.Hosting
88
{
9+
/// <summary>
10+
/// Tracks host lifetime.
11+
/// </summary>
912
public interface IHostLifetime
1013
{
1114
/// <summary>

src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/IHostedService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ public interface IHostedService
1515
/// Triggered when the application host is ready to start the service.
1616
/// </summary>
1717
/// <param name="cancellationToken">Indicates that the start process has been aborted.</param>
18+
/// <returns>A <see cref="Task"/> that represents the asynchronous Start operation.</returns>
1819
Task StartAsync(CancellationToken cancellationToken);
1920

2021
/// <summary>
2122
/// Triggered when the application host is performing a graceful shutdown.
2223
/// </summary>
2324
/// <param name="cancellationToken">Indicates that the shutdown process should no longer be graceful.</param>
25+
/// <returns>A <see cref="Task"/> that represents the asynchronous Stop operation.</returns>
2426
Task StopAsync(CancellationToken cancellationToken);
2527
}
2628
}

src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ISystemdNotifier.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public interface ISystemdNotifier
1111
/// <summary>
1212
/// Sends a notification to systemd.
1313
/// </summary>
14+
/// <param name="state">The <see cref="ServiceState"/> to notify.</param>
1415
void Notify(ServiceState state);
1516
/// <summary>
1617
/// Returns whether systemd is configured to receive service notifications.

src/libraries/Microsoft.Extensions.Hosting.Systemd/src/ServiceState.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public struct ServiceState
2626
/// <summary>
2727
/// Create custom ServiceState.
2828
/// </summary>
29+
/// <param name="state">A <see cref="string"/> representation of service state.</param>
2930
public ServiceState(string state)
3031
{
3132
ThrowHelper.ThrowIfNull(state);
@@ -36,6 +37,7 @@ public ServiceState(string state)
3637
/// <summary>
3738
/// String representation of service state.
3839
/// </summary>
40+
/// <returns>The <see cref="string"/> representation of the service state.</returns>
3941
public override string ToString()
4042
=> _data == null ? string.Empty : Encoding.UTF8.GetString(_data);
4143

0 commit comments

Comments
 (0)