From 1ccef68cb3b01d626ffd2d105d39ade6f468ed52 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 10 May 2021 17:34:35 -0700 Subject: [PATCH] Revert "Move ServiceCollection to abstractions (#52284)" This reverts commit ad7455cc2f5b58af64285828a17e42fdf4e3658e. People are doing reflection... --- ...tensions.DependencyInjection.Abstractions.cs | 17 ----------------- ...t.Extensions.DependencyInjection.Forwards.cs | 7 ------- .../Microsoft.Extensions.DependencyInjection.cs | 17 +++++++++++++++++ ...rosoft.Extensions.DependencyInjection.csproj | 1 - .../src/Properties/TypeForwards.cs | 4 ---- .../src/ServiceCollection.cs | 0 6 files changed, 17 insertions(+), 29 deletions(-) delete mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.Forwards.cs delete mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/src/Properties/TypeForwards.cs rename src/libraries/{Microsoft.Extensions.DependencyInjection.Abstractions => Microsoft.Extensions.DependencyInjection}/src/ServiceCollection.cs (100%) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/ref/Microsoft.Extensions.DependencyInjection.Abstractions.cs b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/ref/Microsoft.Extensions.DependencyInjection.Abstractions.cs index 4f438875cbcf7b..482c51e78384d5 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/ref/Microsoft.Extensions.DependencyInjection.Abstractions.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/ref/Microsoft.Extensions.DependencyInjection.Abstractions.cs @@ -49,23 +49,6 @@ public partial interface ISupportRequiredService object GetRequiredService(System.Type serviceType); } public delegate object ObjectFactory(System.IServiceProvider serviceProvider, object?[]? arguments); - public partial class ServiceCollection : Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public ServiceCollection() { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public Microsoft.Extensions.DependencyInjection.ServiceDescriptor this[int index] { get { throw null; } set { } } - public void Clear() { } - public bool Contains(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } - public void CopyTo(Microsoft.Extensions.DependencyInjection.ServiceDescriptor[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public int IndexOf(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } - public void Insert(int index, Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { } - public bool Remove(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } - public void RemoveAt(int index) { } - void System.Collections.Generic.ICollection.Add(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } public static partial class ServiceCollectionServiceExtensions { public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScoped(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type serviceType) { throw null; } diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.Forwards.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.Forwards.cs deleted file mode 100644 index ea093fb5cc7676..00000000000000 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.Forwards.cs +++ /dev/null @@ -1,7 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// ------------------------------------------------------------------------------ -// Changes to this file must follow the https://aka.ms/api-review process. -// ------------------------------------------------------------------------------ - -[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Extensions.DependencyInjection.ServiceCollection))] diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.cs index d2161d89051508..3b0c8c0af2b3df 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.cs @@ -13,6 +13,23 @@ public DefaultServiceProviderFactory(Microsoft.Extensions.DependencyInjection.Se public Microsoft.Extensions.DependencyInjection.IServiceCollection CreateBuilder(Microsoft.Extensions.DependencyInjection.IServiceCollection services) { throw null; } public System.IServiceProvider CreateServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection containerBuilder) { throw null; } } + public partial class ServiceCollection : Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable + { + public ServiceCollection() { } + public int Count { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public Microsoft.Extensions.DependencyInjection.ServiceDescriptor this[int index] { get { throw null; } set { } } + public void Clear() { } + public bool Contains(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } + public void CopyTo(Microsoft.Extensions.DependencyInjection.ServiceDescriptor[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public int IndexOf(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } + public void Insert(int index, Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { } + public bool Remove(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } + public void RemoveAt(int index) { } + void System.Collections.Generic.ICollection.Add(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } public static partial class ServiceCollectionContainerBuilderExtensions { public static Microsoft.Extensions.DependencyInjection.ServiceProvider BuildServiceProvider(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) { throw null; } diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.csproj index c8ea291c9b5d77..b1b514112a7c05 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.csproj @@ -4,7 +4,6 @@ - diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/Properties/TypeForwards.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/src/Properties/TypeForwards.cs deleted file mode 100644 index 9c4e2191403115..00000000000000 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/src/Properties/TypeForwards.cs +++ /dev/null @@ -1,4 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Extensions.DependencyInjection.ServiceCollection))] diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollection.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceCollection.cs similarity index 100% rename from src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollection.cs rename to src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceCollection.cs