diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/ActionContextAccessor.cs b/src/Mvc/Mvc.Core/src/Infrastructure/ActionContextAccessor.cs
index 5a8213ef9ce2..accf130e6bf0 100644
--- a/src/Mvc/Mvc.Core/src/Infrastructure/ActionContextAccessor.cs
+++ b/src/Mvc/Mvc.Core/src/Infrastructure/ActionContextAccessor.cs
@@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure;
///
/// Type that provides access to an .
///
+[Obsolete("ActionContextAccessor is obsolete and will be removed in a future version. For more information, visit https://aka.ms/aspnet/deprecate/006.", DiagnosticId = "ASPDEPR006")]
public class ActionContextAccessor : IActionContextAccessor
{
internal static readonly IActionContextAccessor Null = new NullActionContextAccessor();
diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvoker.cs b/src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvoker.cs
index 8aef2b4dd2e6..436be14aeddc 100644
--- a/src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvoker.cs
+++ b/src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvoker.cs
@@ -30,7 +30,9 @@ internal partial class ControllerActionInvoker : ResourceInvoker, IActionInvoker
internal ControllerActionInvoker(
ILogger logger,
DiagnosticListener diagnosticListener,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
IActionContextAccessor actionContextAccessor,
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
IActionResultTypeMapper mapper,
ControllerContext controllerContext,
ControllerActionInvokerCacheEntry cacheEntry,
diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvokerProvider.cs b/src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvokerProvider.cs
index 24b6395038bc..4d70251c4340 100644
--- a/src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvokerProvider.cs
+++ b/src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvokerProvider.cs
@@ -23,7 +23,9 @@ internal sealed class ControllerActionInvokerProvider : IActionInvokerProvider
private readonly ILogger _logger;
private readonly DiagnosticListener _diagnosticListener;
private readonly IActionResultTypeMapper _mapper;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
private readonly IActionContextAccessor _actionContextAccessor;
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
public ControllerActionInvokerProvider(
ControllerActionInvokerCache controllerActionInvokerCache,
@@ -41,7 +43,9 @@ public ControllerActionInvokerProvider(
ILoggerFactory loggerFactory,
DiagnosticListener diagnosticListener,
IActionResultTypeMapper mapper,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
IActionContextAccessor? actionContextAccessor)
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
{
_controllerActionInvokerCache = controllerActionInvokerCache;
_valueProviderFactories = optionsAccessor.Value.ValueProviderFactories.ToArray();
@@ -51,7 +55,9 @@ public ControllerActionInvokerProvider(
_logger = loggerFactory.CreateLogger(typeof(ControllerActionInvoker));
_diagnosticListener = diagnosticListener;
_mapper = mapper;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
_actionContextAccessor = actionContextAccessor ?? ActionContextAccessor.Null;
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public int Order => -1000;
diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/IActionContextAccessor.cs b/src/Mvc/Mvc.Core/src/Infrastructure/IActionContextAccessor.cs
index e4ebd8f65a07..60fa2bdf4931 100644
--- a/src/Mvc/Mvc.Core/src/Infrastructure/IActionContextAccessor.cs
+++ b/src/Mvc/Mvc.Core/src/Infrastructure/IActionContextAccessor.cs
@@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure;
///
/// Defines an interface for exposing an .
///
+[Obsolete("IActionContextAccessor is obsolete and will be removed in a future version. For more information, visit https://aka.ms/aspnet/deprecate/006.", DiagnosticId = "ASPDEPR006")]
public interface IActionContextAccessor
{
///
diff --git a/src/Mvc/Mvc.Core/src/Infrastructure/ResourceInvoker.cs b/src/Mvc/Mvc.Core/src/Infrastructure/ResourceInvoker.cs
index f09da93f3c3f..6d2422bea797 100644
--- a/src/Mvc/Mvc.Core/src/Infrastructure/ResourceInvoker.cs
+++ b/src/Mvc/Mvc.Core/src/Infrastructure/ResourceInvoker.cs
@@ -15,7 +15,9 @@ internal abstract partial class ResourceInvoker
{
protected readonly DiagnosticListener _diagnosticListener;
protected readonly ILogger _logger;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
protected readonly IActionContextAccessor _actionContextAccessor;
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
protected readonly IActionResultTypeMapper _mapper;
protected readonly ActionContext _actionContext;
protected readonly IFilterMetadata[] _filters;
@@ -37,7 +39,9 @@ internal abstract partial class ResourceInvoker
public ResourceInvoker(
DiagnosticListener diagnosticListener,
ILogger logger,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
IActionContextAccessor actionContextAccessor,
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
IActionResultTypeMapper mapper,
ActionContext actionContext,
IFilterMetadata[] filters,
diff --git a/src/Mvc/Mvc.Core/src/Routing/ControllerRequestDelegateFactory.cs b/src/Mvc/Mvc.Core/src/Routing/ControllerRequestDelegateFactory.cs
index f31448e78732..4b4bbd1313c9 100644
--- a/src/Mvc/Mvc.Core/src/Routing/ControllerRequestDelegateFactory.cs
+++ b/src/Mvc/Mvc.Core/src/Routing/ControllerRequestDelegateFactory.cs
@@ -24,7 +24,9 @@ internal sealed class ControllerRequestDelegateFactory : IRequestDelegateFactory
private readonly ILogger _logger;
private readonly DiagnosticListener _diagnosticListener;
private readonly IActionResultTypeMapper _mapper;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
private readonly IActionContextAccessor _actionContextAccessor;
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
private readonly bool _enableActionInvokers;
public ControllerRequestDelegateFactory(
@@ -43,7 +45,9 @@ public ControllerRequestDelegateFactory(
ILoggerFactory loggerFactory,
DiagnosticListener diagnosticListener,
IActionResultTypeMapper mapper,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
IActionContextAccessor? actionContextAccessor)
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
{
_controllerActionInvokerCache = controllerActionInvokerCache;
_valueProviderFactories = optionsAccessor.Value.ValueProviderFactories.ToArray();
@@ -54,7 +58,9 @@ public ControllerRequestDelegateFactory(
_logger = loggerFactory.CreateLogger();
_diagnosticListener = diagnosticListener;
_mapper = mapper;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
_actionContextAccessor = actionContextAccessor ?? ActionContextAccessor.Null;
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public RequestDelegate? CreateRequestDelegate(ActionDescriptor actionDescriptor, RouteValueDictionary? dataTokens)
diff --git a/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterTest.cs b/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterTest.cs
index 9816a5deb6ec..14a605a53667 100644
--- a/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterTest.cs
+++ b/src/Mvc/Mvc.Core/test/Filters/MiddlewareFilterTest.cs
@@ -398,7 +398,9 @@ public TestControllerActionInvoker(
: base(
logger,
diagnosticListener,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
ActionContextAccessor.Null,
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
mapper,
CreateControllerContext(actionContext, valueProviderFactories, maxAllowedErrorsInModelState),
CreateCacheEntry((ControllerActionDescriptor)actionContext.ActionDescriptor, controllerFactory),
diff --git a/src/Mvc/Mvc.Core/test/Infrastructure/ControllerActionInvokerTest.cs b/src/Mvc/Mvc.Core/test/Infrastructure/ControllerActionInvokerTest.cs
index 225bb6a407f1..69bdac9ed518 100644
--- a/src/Mvc/Mvc.Core/test/Infrastructure/ControllerActionInvokerTest.cs
+++ b/src/Mvc/Mvc.Core/test/Infrastructure/ControllerActionInvokerTest.cs
@@ -1432,7 +1432,9 @@ public async Task Invoke_UsesDefaultValuesIfNotBound()
var invoker = new ControllerActionInvoker(
new NullLoggerFactory().CreateLogger(),
new DiagnosticListener("Microsoft.AspNetCore"),
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
ActionContextAccessor.Null,
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
new ActionResultTypeMapper(),
controllerContext,
cacheEntry,
@@ -1769,7 +1771,9 @@ private ControllerActionInvoker CreateInvoker(
var invoker = new ControllerActionInvoker(
logger,
diagnosticSource,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
ActionContextAccessor.Null,
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
new ActionResultTypeMapper(),
controllerContext,
cacheEntry,
diff --git a/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageActionInvoker.cs b/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageActionInvoker.cs
index 6ad0d6faa2b4..161bf9800b58 100644
--- a/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageActionInvoker.cs
+++ b/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageActionInvoker.cs
@@ -35,7 +35,9 @@ public PageActionInvoker(
IPageHandlerMethodSelector handlerMethodSelector,
DiagnosticListener diagnosticListener,
ILogger logger,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
IActionContextAccessor actionContextAccessor,
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
IActionResultTypeMapper mapper,
PageContext pageContext,
IFilterMetadata[] filterMetadata,
diff --git a/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageActionInvokerProvider.cs b/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageActionInvokerProvider.cs
index 19f9ff1c7da8..3b9781cd6751 100644
--- a/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageActionInvokerProvider.cs
+++ b/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageActionInvokerProvider.cs
@@ -25,7 +25,9 @@ internal sealed class PageActionInvokerProvider : IActionInvokerProvider
private readonly DiagnosticListener _diagnosticListener;
private readonly ILogger _logger;
private readonly IActionResultTypeMapper _mapper;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
private readonly IActionContextAccessor _actionContextAccessor;
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
public PageActionInvokerProvider(
PageLoader pageLoader,
@@ -38,7 +40,9 @@ public PageActionInvokerProvider(
DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory,
IActionResultTypeMapper mapper,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
IActionContextAccessor? actionContextAccessor = null)
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
{
_pageLoader = pageLoader;
_pageActionInvokerCache = pageActionInvokerCache;
@@ -50,7 +54,9 @@ public PageActionInvokerProvider(
_diagnosticListener = diagnosticListener;
_logger = loggerFactory.CreateLogger();
_mapper = mapper;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
_actionContextAccessor = actionContextAccessor ?? ActionContextAccessor.Null;
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
// For testing
diff --git a/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageRequestDelegateFactory.cs b/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageRequestDelegateFactory.cs
index e6c19ea66350..404e5dd37739 100644
--- a/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageRequestDelegateFactory.cs
+++ b/src/Mvc/Mvc.RazorPages/src/Infrastructure/PageRequestDelegateFactory.cs
@@ -26,7 +26,9 @@ internal sealed class PageRequestDelegateFactory : IRequestDelegateFactory
private readonly DiagnosticListener _diagnosticListener;
private readonly ILogger _logger;
private readonly IActionResultTypeMapper _mapper;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
private readonly IActionContextAccessor _actionContextAccessor;
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
private readonly bool _enableActionInvokers;
public PageRequestDelegateFactory(
@@ -53,7 +55,9 @@ public PageRequestDelegateFactory(
DiagnosticListener diagnosticListener,
ILoggerFactory loggerFactory,
IActionResultTypeMapper mapper,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
IActionContextAccessor? actionContextAccessor)
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
{
_cache = cache;
_valueProviderFactories = mvcOptions.Value.ValueProviderFactories.ToArray();
@@ -65,7 +69,9 @@ public PageRequestDelegateFactory(
_diagnosticListener = diagnosticListener;
_logger = loggerFactory.CreateLogger();
_mapper = mapper;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
_actionContextAccessor = actionContextAccessor ?? ActionContextAccessor.Null;
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public RequestDelegate? CreateRequestDelegate(ActionDescriptor actionDescriptor, RouteValueDictionary? dataTokens)
diff --git a/src/Mvc/Mvc.RazorPages/test/Infrastructure/PageActionInvokerTest.cs b/src/Mvc/Mvc.RazorPages/test/Infrastructure/PageActionInvokerTest.cs
index 3ed467facee4..2294563bc156 100644
--- a/src/Mvc/Mvc.RazorPages/test/Infrastructure/PageActionInvokerTest.cs
+++ b/src/Mvc/Mvc.RazorPages/test/Infrastructure/PageActionInvokerTest.cs
@@ -1565,7 +1565,9 @@ object pageFactory(PageContext context, ViewContext viewContext)
selector.Object,
diagnosticListener ?? new DiagnosticListener("Microsoft.AspNetCore"),
logger ?? NullLogger.Instance,
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
ActionContextAccessor.Null,
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
new ActionResultTypeMapper(),
pageContext,
filters ?? Array.Empty(),
diff --git a/src/Mvc/test/WebSites/BasicWebSite/Startup.cs b/src/Mvc/test/WebSites/BasicWebSite/Startup.cs
index 1a9fb3200c0e..af44ae54e992 100644
--- a/src/Mvc/test/WebSites/BasicWebSite/Startup.cs
+++ b/src/Mvc/test/WebSites/BasicWebSite/Startup.cs
@@ -20,7 +20,9 @@ public void ConfigureServices(IServiceCollection services)
services.AddHttpContextAccessor();
services.AddScoped();
services.AddScoped();
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public void Configure(IApplicationBuilder app)
diff --git a/src/Mvc/test/WebSites/BasicWebSite/StartupWithoutEndpointRouting.cs b/src/Mvc/test/WebSites/BasicWebSite/StartupWithoutEndpointRouting.cs
index 94a467baa003..a43f14b6dfc2 100644
--- a/src/Mvc/test/WebSites/BasicWebSite/StartupWithoutEndpointRouting.cs
+++ b/src/Mvc/test/WebSites/BasicWebSite/StartupWithoutEndpointRouting.cs
@@ -49,7 +49,9 @@ public void ConfigureServices(IServiceCollection services)
services.AddScoped();
services.AddTransient();
services.AddScoped();
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
services.TryAddSingleton(CreateWeatherForecastService);
}
diff --git a/src/Mvc/test/WebSites/Common/TestResponseGenerator.cs b/src/Mvc/test/WebSites/Common/TestResponseGenerator.cs
index b447d97f287f..ab7a804920eb 100644
--- a/src/Mvc/test/WebSites/Common/TestResponseGenerator.cs
+++ b/src/Mvc/test/WebSites/Common/TestResponseGenerator.cs
@@ -12,7 +12,9 @@ public class TestResponseGenerator
{
private readonly ActionContext _actionContext;
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
public TestResponseGenerator(IActionContextAccessor contextAccessor)
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
{
_actionContext = contextAccessor.ActionContext;
if (_actionContext == null)
diff --git a/src/Mvc/test/WebSites/GenericHostWebSite/Startup.cs b/src/Mvc/test/WebSites/GenericHostWebSite/Startup.cs
index 60fe3c2ce951..07e999ccde7a 100644
--- a/src/Mvc/test/WebSites/GenericHostWebSite/Startup.cs
+++ b/src/Mvc/test/WebSites/GenericHostWebSite/Startup.cs
@@ -23,7 +23,9 @@ public void ConfigureServices(IServiceCollection services)
services.AddLogging();
services.AddHttpContextAccessor();
services.AddScoped();
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public void Configure(IApplicationBuilder app)
diff --git a/src/Mvc/test/WebSites/RoutingWebSite/Startup.cs b/src/Mvc/test/WebSites/RoutingWebSite/Startup.cs
index 9438fe0195cb..c3ef0149527d 100644
--- a/src/Mvc/test/WebSites/RoutingWebSite/Startup.cs
+++ b/src/Mvc/test/WebSites/RoutingWebSite/Startup.cs
@@ -29,7 +29,9 @@ public void ConfigureServices(IServiceCollection services)
ConfigureRoutingServices(services);
services.AddScoped();
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public virtual void Configure(IApplicationBuilder app)
diff --git a/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs b/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs
index 4dc4d13e07c2..9726929e10e2 100644
--- a/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs
+++ b/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs
@@ -18,7 +18,9 @@ public void ConfigureServices(IServiceCollection services)
services.AddTransient();
services.AddScoped();
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
// Used by some controllers defined in this project.
services.Configure(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
diff --git a/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamicOrder.cs b/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamicOrder.cs
index 840c50ce64b7..08b61b0c0ea6 100644
--- a/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamicOrder.cs
+++ b/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamicOrder.cs
@@ -33,7 +33,9 @@ public void ConfigureServices(IServiceCollection services)
services.AddTransient();
services.AddScoped();
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
// Used by some controllers defined in this project.
services.Configure(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
diff --git a/src/Mvc/test/WebSites/RoutingWebSite/StartupForEndpointFilters.cs b/src/Mvc/test/WebSites/RoutingWebSite/StartupForEndpointFilters.cs
index 268c19d75f7c..f8424d5c41f3 100644
--- a/src/Mvc/test/WebSites/RoutingWebSite/StartupForEndpointFilters.cs
+++ b/src/Mvc/test/WebSites/RoutingWebSite/StartupForEndpointFilters.cs
@@ -17,7 +17,9 @@ public void ConfigureServices(IServiceCollection services)
services.Configure(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddScoped();
// This is used by test response generator
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public virtual void Configure(IApplicationBuilder app)
diff --git a/src/Mvc/test/WebSites/RoutingWebSite/StartupForFallback.cs b/src/Mvc/test/WebSites/RoutingWebSite/StartupForFallback.cs
index 9fd809a7ea6c..732ec4b82a61 100644
--- a/src/Mvc/test/WebSites/RoutingWebSite/StartupForFallback.cs
+++ b/src/Mvc/test/WebSites/RoutingWebSite/StartupForFallback.cs
@@ -16,7 +16,9 @@ public void ConfigureServices(IServiceCollection services)
.AddNewtonsoftJson();
services.AddScoped();
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
// Used by some controllers defined in this project.
services.Configure(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
diff --git a/src/Mvc/test/WebSites/RoutingWebSite/StartupForGroups.cs b/src/Mvc/test/WebSites/RoutingWebSite/StartupForGroups.cs
index 889c18b40f7a..c055dc3ff23a 100644
--- a/src/Mvc/test/WebSites/RoutingWebSite/StartupForGroups.cs
+++ b/src/Mvc/test/WebSites/RoutingWebSite/StartupForGroups.cs
@@ -17,7 +17,9 @@ public void ConfigureServices(IServiceCollection services)
services.Configure(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddScoped();
// This is used by test response generator
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public virtual void Configure(IApplicationBuilder app)
diff --git a/src/Mvc/test/WebSites/RoutingWebSite/StartupForLinkGenerator.cs b/src/Mvc/test/WebSites/RoutingWebSite/StartupForLinkGenerator.cs
index d9e38eac752b..2792eb795dfe 100644
--- a/src/Mvc/test/WebSites/RoutingWebSite/StartupForLinkGenerator.cs
+++ b/src/Mvc/test/WebSites/RoutingWebSite/StartupForLinkGenerator.cs
@@ -31,7 +31,9 @@ public void ConfigureServices(IServiceCollection services)
});
services.AddScoped();
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public void Configure(IApplicationBuilder app)
diff --git a/src/Mvc/test/WebSites/RoutingWebSite/StartupRoutingDifferentBranches.cs b/src/Mvc/test/WebSites/RoutingWebSite/StartupRoutingDifferentBranches.cs
index afcc67cecfc3..371540eee06d 100644
--- a/src/Mvc/test/WebSites/RoutingWebSite/StartupRoutingDifferentBranches.cs
+++ b/src/Mvc/test/WebSites/RoutingWebSite/StartupRoutingDifferentBranches.cs
@@ -31,7 +31,9 @@ public void ConfigureServices(IServiceCollection services)
services.AddScoped();
// This is used by test response generator
+ #pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
}
diff --git a/src/Mvc/test/WebSites/VersioningWebSite/Startup.cs b/src/Mvc/test/WebSites/VersioningWebSite/Startup.cs
index f4a02003c92f..71e417b8bb98 100644
--- a/src/Mvc/test/WebSites/VersioningWebSite/Startup.cs
+++ b/src/Mvc/test/WebSites/VersioningWebSite/Startup.cs
@@ -14,7 +14,9 @@ public void ConfigureServices(IServiceCollection services)
.AddNewtonsoftJson();
services.AddScoped();
+#pragma warning disable ASPDEPR006 // Type or member is obsolete
services.AddSingleton();
+#pragma warning restore ASPDEPR006 // Type or member is obsolete
}
public virtual void Configure(IApplicationBuilder app)