diff --git a/src/Antiforgery/src/AntiforgeryServiceCollectionExtensions.cs b/src/Antiforgery/src/AntiforgeryServiceCollectionExtensions.cs index a82851b3e2..8cc76d6f94 100644 --- a/src/Antiforgery/src/AntiforgeryServiceCollectionExtensions.cs +++ b/src/Antiforgery/src/AntiforgeryServiceCollectionExtensions.cs @@ -39,6 +39,8 @@ namespace Microsoft.Extensions.DependencyInjection services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton>(serviceProvider => { diff --git a/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs b/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs index 679e3078a4..20c5daab7e 100644 --- a/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs +++ b/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs @@ -96,9 +96,6 @@ namespace Microsoft.AspNetCore.Hosting.Internal // Conjure up a RequestServices services.TryAddTransient(); - // Ensure object pooling is available everywhere. - services.TryAddSingleton(); - // Support UseStartup(assemblyName) if (!string.IsNullOrEmpty(webHostOptions.StartupAssembly)) { diff --git a/src/Hosting/Hosting/src/WebHostBuilder.cs b/src/Hosting/Hosting/src/WebHostBuilder.cs index f076c91bc4..59c12ace29 100644 --- a/src/Hosting/Hosting/src/WebHostBuilder.cs +++ b/src/Hosting/Hosting/src/WebHostBuilder.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -281,9 +281,6 @@ namespace Microsoft.AspNetCore.Hosting services.AddTransient(); services.AddTransient, DefaultServiceProviderFactory>(); - // Ensure object pooling is available everywhere. - services.AddSingleton(); - if (!string.IsNullOrEmpty(_options.StartupAssembly)) { try diff --git a/src/Hosting/Hosting/test/WebHostBuilderTests.cs b/src/Hosting/Hosting/test/WebHostBuilderTests.cs index 5a9f280340..5fcd8943c2 100644 --- a/src/Hosting/Hosting/test/WebHostBuilderTests.cs +++ b/src/Hosting/Hosting/test/WebHostBuilderTests.cs @@ -112,23 +112,7 @@ namespace Microsoft.AspNetCore.Hosting await AssertResponseContains(server.RequestDelegate, "Exception from constructor"); } } - - [Theory] - [MemberData(nameof(DefaultWebHostBuildersWithConfig))] - public async Task DefaultObjectPoolProvider_IsRegistered(IWebHostBuilder builder) - { - var server = new TestServer(); - var host = builder - .UseServer(server) - .Configure(app => { }) - .Build(); - using (host) - { - await host.StartAsync(); - Assert.IsType(host.Services.GetService()); - } - } - + [Theory] [MemberData(nameof(DefaultWebHostBuildersWithConfig))] public async Task StartupConfigureServicesThrows_Fallback(IWebHostBuilder builder) diff --git a/src/Hosting/startvs.cmd b/src/Hosting/startvs.cmd new file mode 100644 index 0000000000..76e555d9fd --- /dev/null +++ b/src/Hosting/startvs.cmd @@ -0,0 +1,3 @@ +@ECHO OFF + +%~dp0..\..\startvs.cmd %~dp0Hosting.sln diff --git a/src/Http/Routing/perf/EndpointRoutingBenchmarkBase.cs b/src/Http/Routing/perf/EndpointRoutingBenchmarkBase.cs index 6a61ff6693..0af2021a72 100644 --- a/src/Http/Routing/perf/EndpointRoutingBenchmarkBase.cs +++ b/src/Http/Routing/perf/EndpointRoutingBenchmarkBase.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -32,7 +32,6 @@ namespace Microsoft.AspNetCore.Routing private protected IServiceProvider CreateServices() { var services = new ServiceCollection(); - services.AddSingleton(); services.AddLogging(); services.AddOptions(); services.AddRouting(); diff --git a/src/Http/Routing/src/DependencyInjection/RoutingServiceCollectionExtensions.cs b/src/Http/Routing/src/DependencyInjection/RoutingServiceCollectionExtensions.cs index ba4e156ae0..c78c64a5f5 100644 --- a/src/Http/Routing/src/DependencyInjection/RoutingServiceCollectionExtensions.cs +++ b/src/Http/Routing/src/DependencyInjection/RoutingServiceCollectionExtensions.cs @@ -33,6 +33,7 @@ namespace Microsoft.Extensions.DependencyInjection } services.TryAddTransient(); + services.TryAddTransient(); services.TryAddSingleton>(s => { var provider = s.GetRequiredService(); @@ -121,4 +122,4 @@ namespace Microsoft.Extensions.DependencyInjection return services; } } -} \ No newline at end of file +} diff --git a/src/Http/Routing/test/UnitTests/LinkGeneratorTestBase.cs b/src/Http/Routing/test/UnitTests/LinkGeneratorTestBase.cs index e9c3880262..117a6695ac 100644 --- a/src/Http/Routing/test/UnitTests/LinkGeneratorTestBase.cs +++ b/src/Http/Routing/test/UnitTests/LinkGeneratorTestBase.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.Http; @@ -32,7 +32,6 @@ namespace Microsoft.AspNetCore.Routing protected ServiceCollection GetBasicServices() { var services = new ServiceCollection(); - services.AddSingleton(); services.AddOptions(); services.AddRouting(); services.AddLogging(); diff --git a/src/Http/Routing/test/UnitTests/RequestDelegateRouteBuilderExtensionsTest.cs b/src/Http/Routing/test/UnitTests/RequestDelegateRouteBuilderExtensionsTest.cs index 825204db5d..7fc5987664 100644 --- a/src/Http/Routing/test/UnitTests/RequestDelegateRouteBuilderExtensionsTest.cs +++ b/src/Http/Routing/test/UnitTests/RequestDelegateRouteBuilderExtensionsTest.cs @@ -127,7 +127,6 @@ namespace Microsoft.AspNetCore.Routing private static IServiceProvider CreateServices() { var services = new ServiceCollection(); - services.AddSingleton(); services.AddOptions(); services.AddRouting(); services.AddLogging(); diff --git a/src/Http/Routing/test/UnitTests/RouteCollectionTest.cs b/src/Http/Routing/test/UnitTests/RouteCollectionTest.cs index c7e33f2754..c46e02ce57 100644 --- a/src/Http/Routing/test/UnitTests/RouteCollectionTest.cs +++ b/src/Http/Routing/test/UnitTests/RouteCollectionTest.cs @@ -606,7 +606,6 @@ namespace Microsoft.AspNetCore.Routing var request = new Mock(MockBehavior.Strict); var services = new ServiceCollection(); - services.AddSingleton(); services.AddOptions(); services.AddRouting(); if (options != null) @@ -628,7 +627,6 @@ namespace Microsoft.AspNetCore.Routing { var services = new ServiceCollection(); services.AddSingleton(NullLoggerFactory.Instance); - services.AddSingleton(); services.AddOptions(); services.AddRouting(); if (options != null) diff --git a/src/Http/Routing/test/UnitTests/RouteTest.cs b/src/Http/Routing/test/UnitTests/RouteTest.cs index 668a54ee8a..4c0f647caf 100644 --- a/src/Http/Routing/test/UnitTests/RouteTest.cs +++ b/src/Http/Routing/test/UnitTests/RouteTest.cs @@ -654,11 +654,10 @@ namespace Microsoft.AspNetCore.Routing public void GetVirtualPath_AlwaysUsesDefaultUrlEncoder() { // Arrange - var nameRouteValue = "name with %special #characters Jörn"; + var nameRouteValue = "name with %special #characters Jörn"; var expected = "/Home/Index?name=" + UrlEncoder.Default.Encode(nameRouteValue); var services = new ServiceCollection(); services.AddSingleton(NullLoggerFactory.Instance); - services.AddSingleton(); services.AddRouting(); // This test encoder should not be used by Routing and should always use the default one. services.AddSingleton(new UrlTestEncoder()); @@ -1521,7 +1520,6 @@ namespace Microsoft.AspNetCore.Routing { var services = new ServiceCollection(); services.AddSingleton(NullLoggerFactory.Instance); - services.AddSingleton(); services.AddRouting(); var context = new DefaultHttpContext diff --git a/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs b/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs index 865bb7cadc..b29f95910e 100644 --- a/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs +++ b/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs @@ -1,10 +1,11 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNetCore.ResponseCaching; using Microsoft.AspNetCore.ResponseCaching.Internal; using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.ObjectPool; namespace Microsoft.Extensions.DependencyInjection { @@ -25,8 +26,9 @@ namespace Microsoft.Extensions.DependencyInjection throw new ArgumentNullException(nameof(services)); } - services.TryAdd(ServiceDescriptor.Singleton()); - services.TryAdd(ServiceDescriptor.Singleton()); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); return services; } diff --git a/src/MusicStore/test/MusicStore.Test/ShoppingCartControllerTest.cs b/src/MusicStore/test/MusicStore.Test/ShoppingCartControllerTest.cs index c5a2a926c7..1eb5a233f4 100644 --- a/src/MusicStore/test/MusicStore.Test/ShoppingCartControllerTest.cs +++ b/src/MusicStore/test/MusicStore.Test/ShoppingCartControllerTest.cs @@ -28,7 +28,6 @@ namespace MusicStore.Controllers var services = new ServiceCollection(); services - .AddSingleton() .AddDbContext(b => b.UseInMemoryDatabase("Scratch").UseInternalServiceProvider(efServiceProvider)); services.AddMvc(); @@ -238,4 +237,4 @@ namespace MusicStore.Controllers }).ToArray(); } } -} \ No newline at end of file +} diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcCoreBuilderExtensions.cs index e68d565e0d..4585cbb218 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcCoreBuilderExtensions.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/DependencyInjection/MvcJsonMvcCoreBuilderExtensions.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.Formatters.Json; using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Options; using Newtonsoft.Json; @@ -73,6 +74,7 @@ namespace Microsoft.Extensions.DependencyInjection // Internal for testing. internal static void AddJsonFormatterServices(IServiceCollection services) { + services.TryAddSingleton(); services.TryAddEnumerable( ServiceDescriptor.Transient, MvcJsonMvcOptionsSetup>()); services.TryAddEnumerable( diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRouteTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRouteTest.cs index bb069a6c78..3b9ca69787 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRouteTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRouteTest.cs @@ -772,7 +772,6 @@ namespace Microsoft.AspNetCore.Mvc.Routing private static TreeRouteBuilder CreateBuilder() { var services = new ServiceCollection() - .AddSingleton() .AddSingleton(NullLoggerFactory.Instance) .AddLogging() .AddRouting() @@ -815,7 +814,6 @@ namespace Microsoft.AspNetCore.Mvc.Routing IActionDescriptorCollectionProvider actionDescriptorProvider) { var services = new ServiceCollection() - .AddSingleton() .AddSingleton(NullLoggerFactory.Instance) .AddLogging() .AddRouting() diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRoutingTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRoutingTest.cs index 692d63743a..4a1ca076d5 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRoutingTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/AttributeRoutingTest.cs @@ -179,10 +179,8 @@ namespace Microsoft.AspNetCore.Mvc.Routing #pragma warning restore CS0618 // Type or member is obsolete var services = new ServiceCollection() - .AddSingleton(inlineConstraintResolver) - .AddSingleton(); + .AddSingleton(inlineConstraintResolver); - services.AddSingleton(); services.AddRouting(); services.AddOptions(); services.AddLogging(); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ControllerLinkGeneratorExtensionsTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ControllerLinkGeneratorExtensionsTest.cs index 2629884624..5b6663ba86 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ControllerLinkGeneratorExtensionsTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/ControllerLinkGeneratorExtensionsTest.cs @@ -195,7 +195,6 @@ namespace Microsoft.AspNetCore.Routing services.AddLogging(); services.AddRouting(); services - .AddSingleton() .AddSingleton(UrlEncoder.Default); services.TryAddEnumerable(ServiceDescriptor.Singleton(new DefaultEndpointDataSource(endpoints))); return services.BuildServiceProvider(); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/PageLinkGeneratorExtensionsTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/PageLinkGeneratorExtensionsTest.cs index 0117674a66..70f7a17221 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/PageLinkGeneratorExtensionsTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/PageLinkGeneratorExtensionsTest.cs @@ -193,7 +193,6 @@ namespace Microsoft.AspNetCore.Routing services.AddLogging(); services.AddRouting(); services - .AddSingleton() .AddSingleton(UrlEncoder.Default); services.TryAddEnumerable(ServiceDescriptor.Singleton(new DefaultEndpointDataSource(endpoints))); return services.BuildServiceProvider(); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/UrlHelperBaseTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/UrlHelperBaseTest.cs index 9bb3f54043..1e0f48bf34 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/UrlHelperBaseTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/UrlHelperBaseTest.cs @@ -109,7 +109,6 @@ namespace Microsoft.AspNetCore.Mvc.Routing services.AddLogging(); services.AddRouting(); services - .AddSingleton() .AddSingleton(UrlEncoder.Default); return services.BuildServiceProvider(); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/UrlHelperTestBase.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/UrlHelperTestBase.cs index d6dfe08822..dd57e88248 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/UrlHelperTestBase.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Core.Test/Routing/UrlHelperTestBase.cs @@ -1018,7 +1018,6 @@ namespace Microsoft.AspNetCore.Mvc.Routing services.AddLogging(); services.AddRouting(); services - .AddSingleton() .AddSingleton(UrlEncoder.Default); return services; } diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/AuthorizeFilterIntegrationTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/AuthorizeFilterIntegrationTest.cs index 30aa58449f..09f6ef48c3 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/AuthorizeFilterIntegrationTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/AuthorizeFilterIntegrationTest.cs @@ -117,8 +117,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests serviceCollection.AddMvc(); serviceCollection .AddSingleton(NullLoggerFactory.Instance) - .AddTransient, Logger>() - .AddSingleton(); + .AddTransient, Logger>(); return serviceCollection.BuildServiceProvider(); } diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/HasValidatorsValidationMetadataProviderIntegrationTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/HasValidatorsValidationMetadataProviderIntegrationTest.cs index 102ddff705..ba8798245c 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/HasValidatorsValidationMetadataProviderIntegrationTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/HasValidatorsValidationMetadataProviderIntegrationTest.cs @@ -21,7 +21,6 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests // Arrange var serviceCollection = new ServiceCollection(); serviceCollection.AddLogging(); - serviceCollection.AddSingleton(); serviceCollection.AddMvc(); var services = serviceCollection.BuildServiceProvider(); @@ -37,7 +36,6 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests // Arrange var serviceCollection = new ServiceCollection(); serviceCollection.AddLogging(); - serviceCollection.AddSingleton(); serviceCollection.AddMvc(mvcOptions => { mvcOptions.ModelMetadataDetailsProviders.Add(new SuppressChildValidationMetadataProvider(typeof(IQueryable))); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/ModelBindingTestHelper.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/ModelBindingTestHelper.cs index 87f8afdfda..be137ba69d 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/ModelBindingTestHelper.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.IntegrationTests/ModelBindingTestHelper.cs @@ -193,7 +193,6 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests serviceCollection.AddMvc(); serviceCollection - .AddSingleton() .AddSingleton(NullLoggerFactory.Instance) .AddTransient, Logger>(); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs index 29176f0989..fa397bcd4b 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs @@ -269,7 +269,6 @@ namespace Microsoft.AspNetCore.Mvc serviceCollection.AddSingleton(diagnosticListener); serviceCollection.AddMvc(); serviceCollection - .AddSingleton() .AddTransient(); if (action != null) diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs index ee06a2deb3..e9fbd9d7b9 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs @@ -256,7 +256,6 @@ namespace Microsoft.AspNetCore.Mvc var services = new ServiceCollection(); services.AddSingleton(GetHostingEnvironment()); - services.AddSingleton(); var diagnosticListener = new DiagnosticListener("Microsoft.AspNet"); services.AddSingleton(diagnosticListener); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/PageRemoteAttributeTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/PageRemoteAttributeTest.cs index 1cf02d3db5..15bb4fe54d 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/PageRemoteAttributeTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/PageRemoteAttributeTest.cs @@ -187,7 +187,6 @@ namespace Microsoft.AspNetCore.Mvc { var serviceCollection = new ServiceCollection(); serviceCollection - .AddSingleton() .AddSingleton(new NullLoggerFactory()); serviceCollection.AddOptions(); diff --git a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/RemoteAttributeTest.cs b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/RemoteAttributeTest.cs index 649b350952..744458f8be 100644 --- a/src/Mvc/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/RemoteAttributeTest.cs +++ b/src/Mvc/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/RemoteAttributeTest.cs @@ -489,7 +489,6 @@ namespace Microsoft.AspNetCore.Mvc { var serviceCollection = new ServiceCollection(); serviceCollection - .AddSingleton() .AddSingleton(new NullLoggerFactory()); serviceCollection.AddOptions();