Skip to content

Commit 8e5a837

Browse files
Copilotcaptainsafia
andcommitted
Suppress obsolete warnings in test files and websites that use deprecated IActionContextAccessor
Co-authored-by: captainsafia <[email protected]>
1 parent 6ecda20 commit 8e5a837

File tree

14 files changed

+28
-0
lines changed

14 files changed

+28
-0
lines changed

src/Mvc/Mvc.RazorPages/test/Infrastructure/PageActionInvokerTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,9 @@ object pageFactory(PageContext context, ViewContext viewContext)
15651565
selector.Object,
15661566
diagnosticListener ?? new DiagnosticListener("Microsoft.AspNetCore"),
15671567
logger ?? NullLogger.Instance,
1568+
#pragma warning disable CS0618 // Type or member is obsolete
15681569
ActionContextAccessor.Null,
1570+
#pragma warning restore CS0618 // Type or member is obsolete
15691571
new ActionResultTypeMapper(),
15701572
pageContext,
15711573
filters ?? Array.Empty<IFilterMetadata>(),

src/Mvc/test/WebSites/BasicWebSite/Startup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public void ConfigureServices(IServiceCollection services)
2020
services.AddHttpContextAccessor();
2121
services.AddScoped<RequestIdService>();
2222
services.AddScoped<TestResponseGenerator>();
23+
#pragma warning disable CS0618 // Type or member is obsolete
2324
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
25+
#pragma warning restore CS0618 // Type or member is obsolete
2426
}
2527

2628
public void Configure(IApplicationBuilder app)

src/Mvc/test/WebSites/BasicWebSite/StartupWithoutEndpointRouting.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public void ConfigureServices(IServiceCollection services)
4949
services.AddScoped<RequestIdService>();
5050
services.AddTransient<ServiceActionFilter>();
5151
services.AddScoped<TestResponseGenerator>();
52+
#pragma warning disable CS0618 // Type or member is obsolete
5253
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
54+
#pragma warning restore CS0618 // Type or member is obsolete
5355
services.TryAddSingleton(CreateWeatherForecastService);
5456
}
5557

src/Mvc/test/WebSites/Common/TestResponseGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ public class TestResponseGenerator
1212
{
1313
private readonly ActionContext _actionContext;
1414

15+
#pragma warning disable CS0618 // Type or member is obsolete
1516
public TestResponseGenerator(IActionContextAccessor contextAccessor)
17+
#pragma warning restore CS0618 // Type or member is obsolete
1618
{
1719
_actionContext = contextAccessor.ActionContext;
1820
if (_actionContext == null)

src/Mvc/test/WebSites/GenericHostWebSite/Startup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ public void ConfigureServices(IServiceCollection services)
2323
services.AddLogging();
2424
services.AddHttpContextAccessor();
2525
services.AddScoped<TestResponseGenerator>();
26+
#pragma warning disable CS0618 // Type or member is obsolete
2627
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
28+
#pragma warning restore CS0618 // Type or member is obsolete
2729
}
2830

2931
public void Configure(IApplicationBuilder app)

src/Mvc/test/WebSites/RoutingWebSite/Startup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public void ConfigureServices(IServiceCollection services)
2929
ConfigureRoutingServices(services);
3030

3131
services.AddScoped<TestResponseGenerator>();
32+
#pragma warning disable CS0618 // Type or member is obsolete
3233
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
34+
#pragma warning restore CS0618 // Type or member is obsolete
3335
}
3436

3537
public virtual void Configure(IApplicationBuilder app)

src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public void ConfigureServices(IServiceCollection services)
1818

1919
services.AddTransient<Transformer>();
2020
services.AddScoped<TestResponseGenerator>();
21+
#pragma warning disable CS0618 // Type or member is obsolete
2122
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
23+
#pragma warning restore CS0618 // Type or member is obsolete
2224

2325
// Used by some controllers defined in this project.
2426
services.Configure<RouteOptions>(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));

src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamicOrder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public void ConfigureServices(IServiceCollection services)
3333

3434
services.AddTransient<Transformer>();
3535
services.AddScoped<TestResponseGenerator>();
36+
#pragma warning disable CS0618 // Type or member is obsolete
3637
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
38+
#pragma warning restore CS0618 // Type or member is obsolete
3739

3840
// Used by some controllers defined in this project.
3941
services.Configure<RouteOptions>(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));

src/Mvc/test/WebSites/RoutingWebSite/StartupForEndpointFilters.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public void ConfigureServices(IServiceCollection services)
1717
services.Configure<RouteOptions>(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
1818
services.AddScoped<TestResponseGenerator>();
1919
// This is used by test response generator
20+
#pragma warning disable CS0618 // Type or member is obsolete
2021
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
22+
#pragma warning restore CS0618 // Type or member is obsolete
2123
}
2224

2325
public virtual void Configure(IApplicationBuilder app)

src/Mvc/test/WebSites/RoutingWebSite/StartupForFallback.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public void ConfigureServices(IServiceCollection services)
1616
.AddNewtonsoftJson();
1717

1818
services.AddScoped<TestResponseGenerator>();
19+
#pragma warning disable CS0618 // Type or member is obsolete
1920
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
21+
#pragma warning restore CS0618 // Type or member is obsolete
2022

2123
// Used by some controllers defined in this project.
2224
services.Configure<RouteOptions>(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));

0 commit comments

Comments
 (0)