Skip to content

Commit fc1770f

Browse files
Update WebHost obsolete attribute to use ASPDEPR008 diagnostic code and update pragma disables
Co-authored-by: BrennanConroy <[email protected]>
1 parent 693f32a commit fc1770f

File tree

9 files changed

+13
-11
lines changed

9 files changed

+13
-11
lines changed

src/DefaultBuilder/samples/SampleApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#pragma warning disable CS0618 // Type or member is obsolete
4+
#pragma warning disable ASPDEPR008 // Type or member is obsolete
55

66
using Microsoft.AspNetCore;
77

src/DefaultBuilder/src/GenericHostBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public static IHostBuilder ConfigureWebHostDefaults(this IHostBuilder builder, A
6161

6262
return builder.ConfigureWebHost(webHostBuilder =>
6363
{
64-
#pragma warning disable CS0618 // Type or member is obsolete
64+
#pragma warning disable ASPDEPR008 // Type or member is obsolete
6565
WebHost.ConfigureWebDefaults(webHostBuilder);
66-
#pragma warning restore CS0618 // Type or member is obsolete
66+
#pragma warning restore ASPDEPR008 // Type or member is obsolete
6767

6868
configure(webHostBuilder);
6969
}, configureOptions);

src/DefaultBuilder/src/WebApplicationBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ internal WebApplicationBuilder(WebApplicationOptions options, bool slim, Action<
127127
bootstrapHostBuilder.ConfigureSlimWebHost(
128128
webHostBuilder =>
129129
{
130-
#pragma warning disable CS0618 // Type or member is obsolete
130+
#pragma warning disable ASPDEPR008 // Type or member is obsolete
131131
AspNetCore.WebHost.ConfigureWebDefaultsSlim(webHostBuilder);
132-
#pragma warning restore CS0618 // Type or member is obsolete
132+
#pragma warning restore ASPDEPR008 // Type or member is obsolete
133133

134134
// Runs inline.
135135
webHostBuilder.Configure(ConfigureApplication);

src/DefaultBuilder/src/WebHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore;
2121
/// <summary>
2222
/// Provides convenience methods for creating instances of <see cref="IWebHost"/> and <see cref="IWebHostBuilder"/> with pre-configured defaults.
2323
/// </summary>
24-
[Obsolete("WebHost is obsolete. Use HostBuilder or WebApplicationBuilder instead.")]
24+
[Obsolete("WebHost is obsolete. Use HostBuilder or WebApplicationBuilder instead.", DiagnosticId = "ASPDEPR008")]
2525
public static class WebHost
2626
{
2727
/// <summary>

src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#pragma warning disable CS0618 // Type or member is obsolete
4+
#pragma warning disable ASPDEPR008 // Type or member is obsolete
55

66
using System.Net.Http;
77
using Microsoft.AspNetCore.Http;

src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebHostTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#pragma warning disable CS0618 // Type or member is obsolete
4+
#pragma warning disable ASPDEPR008 // Type or member is obsolete
55
#pragma warning disable ASPDEPR008 // IWebHost is obsolete
66

77
using System.Collections.Concurrent;
@@ -80,7 +80,9 @@ public async Task WebHostConfiguration_EnablesForwardedHeadersFromConfig()
8080
}).Build();
8181

8282
await host.StartAsync();
83+
#pragma warning disable CS0618 // Type or member is obsolete
8384
var client = host.GetTestClient();
85+
#pragma warning restore CS0618 // Type or member is obsolete
8486
client.DefaultRequestHeaders.Add("x-forwarded-proto", "https");
8587
var result = await client.GetAsync("http://localhost/");
8688
result.EnsureSuccessStatusCode();

src/DefaultBuilder/testassets/StartRequestDelegateUrlApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#pragma warning disable CS0618 // Type or member is obsolete
4+
#pragma warning disable ASPDEPR008 // Type or member is obsolete
55

66
using System;
77
using System.Threading;

src/DefaultBuilder/testassets/StartRouteBuilderUrlApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#pragma warning disable CS0618 // Type or member is obsolete
4+
#pragma warning disable ASPDEPR008 // Type or member is obsolete
55

66
using System;
77
using System.Threading;

src/DefaultBuilder/testassets/StartWithIApplicationBuilderUrlApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#pragma warning disable CS0618 // Type or member is obsolete
4+
#pragma warning disable ASPDEPR008 // Type or member is obsolete
55

66
using System;
77
using System.Threading;

0 commit comments

Comments
 (0)