From 05853e0496b4dc9f1e83a38af30071773ff151e7 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 19 Feb 2026 13:18:20 +0000
Subject: [PATCH 1/4] Initial plan
From 3bf84b3e7639c662f27b9fd336623c9775814eda Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 19 Feb 2026 13:38:01 +0000
Subject: [PATCH 2/4] Add remarks and seealso docs to DI Add* and TryAdd*
methods
Co-authored-by: svick <287848+svick@users.noreply.github.com>
---
...iceCollectionDescriptorExtensions.Keyed.cs | 19 +++
.../ServiceCollectionDescriptorExtensions.cs | 19 +++
...erviceCollectionServiceExtensions.Keyed.cs | 115 ++++++++++++++++++
.../src/ServiceCollectionServiceExtensions.cs | 115 ++++++++++++++++++
4 files changed, 268 insertions(+)
diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Extensions/ServiceCollectionDescriptorExtensions.Keyed.cs b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Extensions/ServiceCollectionDescriptorExtensions.Keyed.cs
index ed317a6cf104c8..b66572b3dd74d1 100644
--- a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Extensions/ServiceCollectionDescriptorExtensions.Keyed.cs
+++ b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Extensions/ServiceCollectionDescriptorExtensions.Keyed.cs
@@ -16,6 +16,7 @@ public static partial class ServiceCollectionDescriptorExtensions
/// The .
/// The type of the service to register.
/// The service key.
+ ///
public static void TryAddKeyedTransient(
this IServiceCollection collection,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service,
@@ -37,6 +38,7 @@ public static void TryAddKeyedTransient(
/// The type of the service to register.
/// The service key.
/// The implementation type of the service.
+ ///
public static void TryAddKeyedTransient(
this IServiceCollection collection,
Type service,
@@ -60,6 +62,7 @@ public static void TryAddKeyedTransient(
/// The type of the service to register.
/// The service key.
/// The factory that creates the service.
+ ///
public static void TryAddKeyedTransient(
this IServiceCollection collection,
Type service,
@@ -81,6 +84,7 @@ public static void TryAddKeyedTransient(
/// The type of the service to add.
/// The .
/// The service key.
+ ///
public static void TryAddKeyedTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection, object? serviceKey)
where TService : class
{
@@ -98,6 +102,7 @@ public static void TryAddKeyedTransient(
/// The type of the implementation to use.
/// The .
/// The service key.
+ ///
public static void TryAddKeyedTransient(this IServiceCollection collection, object? serviceKey)
where TService : class
where TImplementation : class, TService
@@ -116,6 +121,7 @@ public static void TryAddKeyedTransient(
/// The .
/// The service key.
/// The factory that creates the service.
+ ///
public static void TryAddKeyedTransient(
this IServiceCollection services,
object? serviceKey,
@@ -132,6 +138,7 @@ public static void TryAddKeyedTransient(
/// The .
/// The type of the service to register.
/// The service key.
+ ///
public static void TryAddKeyedScoped(
this IServiceCollection collection,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service,
@@ -153,6 +160,7 @@ public static void TryAddKeyedScoped(
/// The type of the service to register.
/// The service key.
/// The implementation type of the service.
+ ///
public static void TryAddKeyedScoped(
this IServiceCollection collection,
Type service,
@@ -176,6 +184,7 @@ public static void TryAddKeyedScoped(
/// The type of the service to register.
/// The service key.
/// The factory that creates the service.
+ ///
public static void TryAddKeyedScoped(
this IServiceCollection collection,
Type service,
@@ -197,6 +206,7 @@ public static void TryAddKeyedScoped(
/// The type of the service to add.
/// The .
/// The service key.
+ ///
public static void TryAddKeyedScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection, object? serviceKey)
where TService : class
{
@@ -214,6 +224,7 @@ public static void TryAddKeyedScoped(
/// The type of the implementation to use.
/// The .
/// The service key.
+ ///
public static void TryAddKeyedScoped(this IServiceCollection collection, object? serviceKey)
where TService : class
where TImplementation : class, TService
@@ -232,6 +243,7 @@ public static void TryAddKeyedScoped(
/// The .
/// The factory that creates the service.
/// The service key.
+ ///
public static void TryAddKeyedScoped(
this IServiceCollection services,
object? serviceKey,
@@ -248,6 +260,7 @@ public static void TryAddKeyedScoped(
/// The .
/// The type of the service to register.
/// The service key.
+ ///
public static void TryAddKeyedSingleton(
this IServiceCollection collection,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service,
@@ -269,6 +282,7 @@ public static void TryAddKeyedSingleton(
/// The type of the service to register.
/// The service key.
/// The implementation type of the service.
+ ///
public static void TryAddKeyedSingleton(
this IServiceCollection collection,
Type service,
@@ -292,6 +306,7 @@ public static void TryAddKeyedSingleton(
/// The type of the service to register.
/// The service key.
/// The factory that creates the service.
+ ///
public static void TryAddKeyedSingleton(
this IServiceCollection collection,
Type service,
@@ -313,6 +328,7 @@ public static void TryAddKeyedSingleton(
/// The type of the service to add.
/// The .
/// The service key.
+ ///
public static void TryAddKeyedSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection, object? serviceKey)
where TService : class
{
@@ -330,6 +346,7 @@ public static void TryAddKeyedSingleton(
/// The type of the implementation to use.
/// The .
/// The service key.
+ ///
public static void TryAddKeyedSingleton(this IServiceCollection collection, object? serviceKey)
where TService : class
where TImplementation : class, TService
@@ -348,6 +365,7 @@ public static void TryAddKeyedSingleton(
/// The .
/// The service key.
/// The instance of the service to add.
+ ///
public static void TryAddKeyedSingleton(this IServiceCollection collection, object? serviceKey, TService instance)
where TService : class
{
@@ -367,6 +385,7 @@ public static void TryAddKeyedSingleton(this IServiceCollection collec
/// The .
/// The service key.
/// The factory that creates the service.
+ ///
public static void TryAddKeyedSingleton(
this IServiceCollection services,
object? serviceKey,
diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Extensions/ServiceCollectionDescriptorExtensions.cs b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Extensions/ServiceCollectionDescriptorExtensions.cs
index 5e2f500d76581a..3d519f96e8cd00 100644
--- a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Extensions/ServiceCollectionDescriptorExtensions.cs
+++ b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Extensions/ServiceCollectionDescriptorExtensions.cs
@@ -102,6 +102,7 @@ public static void TryAdd(
///
/// The .
/// The type of the service to register.
+ ///
public static void TryAddTransient(
this IServiceCollection collection,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service)
@@ -121,6 +122,7 @@ public static void TryAddTransient(
/// The .
/// The type of the service to register.
/// The implementation type of the service.
+ ///
public static void TryAddTransient(
this IServiceCollection collection,
Type service,
@@ -142,6 +144,7 @@ public static void TryAddTransient(
/// The .
/// The type of the service to register.
/// The factory that creates the service.
+ ///
public static void TryAddTransient(
this IServiceCollection collection,
Type service,
@@ -161,6 +164,7 @@ public static void TryAddTransient(
///
/// The type of the service to add.
/// The .
+ ///
public static void TryAddTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection)
where TService : class
{
@@ -177,6 +181,7 @@ public static void TryAddTransient(
/// The type of the service to add.
/// The type of the implementation to use.
/// The .
+ ///
public static void TryAddTransient(this IServiceCollection collection)
where TService : class
where TImplementation : class, TService
@@ -194,6 +199,7 @@ public static void TryAddTransient(
/// The type of the service to add.
/// The .
/// The factory that creates the service.
+ ///
public static void TryAddTransient(
this IServiceCollection services,
Func implementationFactory)
@@ -208,6 +214,7 @@ public static void TryAddTransient(
///
/// The .
/// The type of the service to register.
+ ///
public static void TryAddScoped(
this IServiceCollection collection,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service)
@@ -227,6 +234,7 @@ public static void TryAddScoped(
/// The .
/// The type of the service to register.
/// The implementation type of the service.
+ ///
public static void TryAddScoped(
this IServiceCollection collection,
Type service,
@@ -248,6 +256,7 @@ public static void TryAddScoped(
/// The .
/// The type of the service to register.
/// The factory that creates the service.
+ ///
public static void TryAddScoped(
this IServiceCollection collection,
Type service,
@@ -267,6 +276,7 @@ public static void TryAddScoped(
///
/// The type of the service to add.
/// The .
+ ///
public static void TryAddScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection)
where TService : class
{
@@ -283,6 +293,7 @@ public static void TryAddScoped(
/// The type of the service to add.
/// The type of the implementation to use.
/// The .
+ ///
public static void TryAddScoped(this IServiceCollection collection)
where TService : class
where TImplementation : class, TService
@@ -300,6 +311,7 @@ public static void TryAddScoped(
/// The type of the service to add.
/// The .
/// The factory that creates the service.
+ ///
public static void TryAddScoped(
this IServiceCollection services,
Func implementationFactory)
@@ -314,6 +326,7 @@ public static void TryAddScoped(
///
/// The .
/// The type of the service to register.
+ ///
public static void TryAddSingleton(
this IServiceCollection collection,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service)
@@ -333,6 +346,7 @@ public static void TryAddSingleton(
/// The .
/// The type of the service to register.
/// The implementation type of the service.
+ ///
public static void TryAddSingleton(
this IServiceCollection collection,
Type service,
@@ -354,6 +368,7 @@ public static void TryAddSingleton(
/// The .
/// The type of the service to register.
/// The factory that creates the service.
+ ///
public static void TryAddSingleton(
this IServiceCollection collection,
Type service,
@@ -373,6 +388,7 @@ public static void TryAddSingleton(
///
/// The type of the service to add.
/// The .
+ ///
public static void TryAddSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection)
where TService : class
{
@@ -389,6 +405,7 @@ public static void TryAddSingleton(
/// The type of the service to add.
/// The type of the implementation to use.
/// The .
+ ///
public static void TryAddSingleton(this IServiceCollection collection)
where TService : class
where TImplementation : class, TService
@@ -406,6 +423,7 @@ public static void TryAddSingleton(
/// The type of the service to add.
/// The .
/// The instance of the service to add.
+ ///
public static void TryAddSingleton(this IServiceCollection collection, TService instance)
where TService : class
{
@@ -424,6 +442,7 @@ public static void TryAddSingleton(this IServiceCollection collection,
/// The type of the service to add.
/// The .
/// The factory that creates the service.
+ ///
public static void TryAddSingleton(
this IServiceCollection services,
Func implementationFactory)
diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs
index 791c8b172ba11d..0ec2241ca85537 100644
--- a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs
+++ b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs
@@ -21,6 +21,11 @@ public static partial class ServiceCollectionServiceExtensions
/// The of the service.
/// The implementation type of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedTransient(
this IServiceCollection services,
@@ -45,6 +50,11 @@ public static IServiceCollection AddKeyedTransient(
/// The of the service.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedTransient(
this IServiceCollection services,
@@ -69,6 +79,11 @@ public static IServiceCollection AddKeyedTransient(
/// The to add the service to.
/// The of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedTransient(
this IServiceCollection services,
@@ -89,6 +104,11 @@ public static IServiceCollection AddKeyedTransient(
/// The type of the service to register and the implementation to use.
/// The of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedTransient(
this IServiceCollection services,
@@ -109,6 +129,11 @@ public static IServiceCollection AddKeyedTransient(
/// The to add the service to.
/// The of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(
this IServiceCollection services,
@@ -130,6 +155,11 @@ public static IServiceCollection AddKeyedTransient(
/// The of the service.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedTransient(
this IServiceCollection services,
@@ -155,6 +185,11 @@ public static IServiceCollection AddKeyedTransient(
/// The of the service.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedTransient(
this IServiceCollection services,
@@ -179,6 +214,11 @@ public static IServiceCollection AddKeyedTransient(
/// The of the service.
/// The implementation type of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedScoped(
this IServiceCollection services,
@@ -203,6 +243,11 @@ public static IServiceCollection AddKeyedScoped(
/// The of the service.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedScoped(
this IServiceCollection services,
@@ -227,6 +272,11 @@ public static IServiceCollection AddKeyedScoped(
/// The to add the service to.
/// The of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedScoped(
this IServiceCollection services,
@@ -247,6 +297,11 @@ public static IServiceCollection AddKeyedScoped(
/// The type of the service to register and the implementation to use.
/// The of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedScoped(
this IServiceCollection services,
@@ -267,6 +322,11 @@ public static IServiceCollection AddKeyedScoped(
/// The to add the service to.
/// The of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(
this IServiceCollection services,
@@ -288,6 +348,11 @@ public static IServiceCollection AddKeyedScoped(
/// The of the service.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedScoped(
this IServiceCollection services,
@@ -313,6 +378,11 @@ public static IServiceCollection AddKeyedScoped(
/// The of the service.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedScoped(
this IServiceCollection services,
@@ -337,6 +407,11 @@ public static IServiceCollection AddKeyedScoped(
/// The of the service.
/// The implementation type of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedSingleton(
this IServiceCollection services,
@@ -361,6 +436,11 @@ public static IServiceCollection AddKeyedSingleton(
/// The of the service.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedSingleton(
this IServiceCollection services,
@@ -385,6 +465,11 @@ public static IServiceCollection AddKeyedSingleton(
/// The to add the service to.
/// The of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedSingleton(
this IServiceCollection services,
@@ -405,6 +490,11 @@ public static IServiceCollection AddKeyedSingleton(
/// The type of the service to register and the implementation to use.
/// The of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedSingleton(
this IServiceCollection services,
@@ -425,6 +515,11 @@ public static IServiceCollection AddKeyedSingleton(
/// The to add the service to.
/// The of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(
this IServiceCollection services,
@@ -446,6 +541,11 @@ public static IServiceCollection AddKeyedSingleton(
/// The of the service.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedSingleton(
this IServiceCollection services,
@@ -471,6 +571,11 @@ public static IServiceCollection AddKeyedSingleton(
/// The of the service.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedSingleton(
this IServiceCollection services,
@@ -495,6 +600,11 @@ public static IServiceCollection AddKeyedSingleton(
/// The of the service.
/// The instance of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedSingleton(
this IServiceCollection services,
@@ -520,6 +630,11 @@ public static IServiceCollection AddKeyedSingleton(
/// The of the service.
/// The instance of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddKeyedSingleton(
this IServiceCollection services,
diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.cs b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.cs
index f78df8af8a6d89..6aed5e65f7c697 100644
--- a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.cs
+++ b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.cs
@@ -20,6 +20,11 @@ public static partial class ServiceCollectionServiceExtensions
/// The type of the service to register.
/// The implementation type of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddTransient(
this IServiceCollection services,
@@ -42,6 +47,11 @@ public static IServiceCollection AddTransient(
/// The type of the service to register.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddTransient(
this IServiceCollection services,
@@ -64,6 +74,11 @@ public static IServiceCollection AddTransient(
/// The type of the implementation to use.
/// The to add the service to.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddTransient(this IServiceCollection services)
where TService : class
@@ -81,6 +96,11 @@ public static IServiceCollection AddTransient(
/// The to add the service to.
/// The type of the service to register and the implementation to use.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddTransient(
this IServiceCollection services,
@@ -99,6 +119,11 @@ public static IServiceCollection AddTransient(
/// The type of the service to add.
/// The to add the service to.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services)
where TService : class
@@ -117,6 +142,11 @@ public static IServiceCollection AddTransient(
/// The to add the service to.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddTransient(
this IServiceCollection services,
@@ -140,6 +170,11 @@ public static IServiceCollection AddTransient(
/// The to add the service to.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddTransient(
this IServiceCollection services,
@@ -162,6 +197,11 @@ public static IServiceCollection AddTransient(
/// The type of the service to register.
/// The implementation type of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddScoped(
this IServiceCollection services,
@@ -184,6 +224,11 @@ public static IServiceCollection AddScoped(
/// The type of the service to register.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddScoped(
this IServiceCollection services,
@@ -206,6 +251,11 @@ public static IServiceCollection AddScoped(
/// The type of the implementation to use.
/// The to add the service to.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddScoped(this IServiceCollection services)
where TService : class
@@ -223,6 +273,11 @@ public static IServiceCollection AddScoped(
/// The to add the service to.
/// The type of the service to register and the implementation to use.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddScoped(
this IServiceCollection services,
@@ -241,6 +296,11 @@ public static IServiceCollection AddScoped(
/// The type of the service to add.
/// The to add the service to.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services)
where TService : class
@@ -259,6 +319,11 @@ public static IServiceCollection AddScoped(
/// The to add the service to.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddScoped(
this IServiceCollection services,
@@ -282,6 +347,11 @@ public static IServiceCollection AddScoped(
/// The to add the service to.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddScoped(
this IServiceCollection services,
@@ -305,6 +375,11 @@ public static IServiceCollection AddScoped(
/// The type of the service to register.
/// The implementation type of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddSingleton(
this IServiceCollection services,
@@ -327,6 +402,11 @@ public static IServiceCollection AddSingleton(
/// The type of the service to register.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddSingleton(
this IServiceCollection services,
@@ -349,6 +429,11 @@ public static IServiceCollection AddSingleton(
/// The type of the implementation to use.
/// The to add the service to.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddSingleton(this IServiceCollection services)
where TService : class
@@ -366,6 +451,11 @@ public static IServiceCollection AddSingleton(
/// The to add the service to.
/// The type of the service to register and the implementation to use.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddSingleton(
this IServiceCollection services,
@@ -384,6 +474,11 @@ public static IServiceCollection AddSingleton(
/// The type of the service to add.
/// The to add the service to.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services)
where TService : class
@@ -402,6 +497,11 @@ public static IServiceCollection AddSingleton(
/// The to add the service to.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddSingleton(
this IServiceCollection services,
@@ -425,6 +525,11 @@ public static IServiceCollection AddSingleton(
/// The to add the service to.
/// The factory that creates the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddSingleton(
this IServiceCollection services,
@@ -447,6 +552,11 @@ public static IServiceCollection AddSingleton(
/// The type of the service to register.
/// The instance of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddSingleton(
this IServiceCollection services,
@@ -470,6 +580,11 @@ public static IServiceCollection AddSingleton(
/// The to add the service to.
/// The instance of the service.
/// A reference to this instance after the operation has completed.
+ ///
+ /// This method always adds a new registration to the , even if a service of the same type has already been registered.
+ /// When multiple registrations exist, returns the last registered service.
+ /// Use to retrieve all registered services.
+ ///
///
public static IServiceCollection AddSingleton(
this IServiceCollection services,
From ca930089628110a217cddf45d7fc9df7869e7b8e Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 19 Feb 2026 15:03:57 +0000
Subject: [PATCH 3/4] Fix keyed service docs to reference
GetKeyedService/GetKeyedServices
Co-authored-by: svick <287848+svick@users.noreply.github.com>
---
...erviceCollectionServiceExtensions.Keyed.cs | 92 +++++++++----------
1 file changed, 46 insertions(+), 46 deletions(-)
diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs
index 0ec2241ca85537..6cf86527d93791 100644
--- a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs
+++ b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs
@@ -23,8 +23,8 @@ public static partial class ServiceCollectionServiceExtensions
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -52,8 +52,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -81,8 +81,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -106,8 +106,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -131,8 +131,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(
@@ -157,8 +157,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -187,8 +187,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -216,8 +216,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -245,8 +245,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -274,8 +274,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -299,8 +299,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -324,8 +324,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(
@@ -350,8 +350,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -380,8 +380,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -409,8 +409,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -438,8 +438,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -467,8 +467,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -492,8 +492,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -517,8 +517,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(
@@ -543,8 +543,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -573,8 +573,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -602,8 +602,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -632,8 +632,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
From 45576414729f6ec827415eaa75550121bd0c98c0 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 19 Feb 2026 15:15:30 +0000
Subject: [PATCH 4/4] Fix generic syntax in XML doc cref attributes in Keyed
extensions
Co-authored-by: svick <287848+svick@users.noreply.github.com>
---
...erviceCollectionServiceExtensions.Keyed.cs | 92 +++++++++----------
1 file changed, 46 insertions(+), 46 deletions(-)
diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs
index 6cf86527d93791..f3f80a97235927 100644
--- a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs
+++ b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollectionServiceExtensions.Keyed.cs
@@ -23,8 +23,8 @@ public static partial class ServiceCollectionServiceExtensions
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -52,8 +52,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -81,8 +81,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -106,8 +106,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -131,8 +131,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(
@@ -157,8 +157,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -187,8 +187,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedTransient(
@@ -216,8 +216,8 @@ public static IServiceCollection AddKeyedTransient(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -245,8 +245,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -274,8 +274,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -299,8 +299,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -324,8 +324,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(
@@ -350,8 +350,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -380,8 +380,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedScoped(
@@ -409,8 +409,8 @@ public static IServiceCollection AddKeyedScoped(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -438,8 +438,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -467,8 +467,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -492,8 +492,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -517,8 +517,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(
@@ -543,8 +543,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -573,8 +573,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -602,8 +602,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(
@@ -632,8 +632,8 @@ public static IServiceCollection AddKeyedSingleton(
/// A reference to this instance after the operation has completed.
///
/// This method always adds a new registration to the , even if a service of the same type and key has already been registered.
- /// When multiple registrations exist for the same type and key, returns the last registered service.
- /// Use to retrieve all registered services.
+ /// When multiple registrations exist for the same type and key, returns the last registered service.
+ /// Use to retrieve all registered services.
///
///
public static IServiceCollection AddKeyedSingleton(