Skip to content

Commit bc78cd9

Browse files
committed
Annotate Hosting with nullable
1 parent 628edba commit bc78cd9

5 files changed

+9
-7
lines changed

src/Hosting/Abstractions/ref/Microsoft.AspNetCore.Hosting.Abstractions.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
5+
<Nullable>annotations</Nullable>
56
</PropertyGroup>
67
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'">
78
<Compile Include="Microsoft.AspNetCore.Hosting.Abstractions.netcoreapp.cs" />

src/Hosting/Abstractions/ref/Microsoft.AspNetCore.Hosting.Abstractions.netcoreapp.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public partial interface IWebHostBuilder
9393
Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureAppConfiguration(System.Action<Microsoft.AspNetCore.Hosting.WebHostBuilderContext, Microsoft.Extensions.Configuration.IConfigurationBuilder> configureDelegate);
9494
Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureServices(System.Action<Microsoft.AspNetCore.Hosting.WebHostBuilderContext, Microsoft.Extensions.DependencyInjection.IServiceCollection> configureServices);
9595
Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureServices(System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> configureServices);
96-
string GetSetting(string key);
97-
Microsoft.AspNetCore.Hosting.IWebHostBuilder UseSetting(string key, string value);
96+
string? GetSetting(string key);
97+
Microsoft.AspNetCore.Hosting.IWebHostBuilder UseSetting(string key, string? value);
9898
}
9999
public partial interface IWebHostEnvironment : Microsoft.Extensions.Hosting.IHostEnvironment
100100
{

src/Hosting/Abstractions/src/IWebHostBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ public interface IWebHostBuilder
5050
/// </summary>
5151
/// <param name="key">The key of the setting to look up.</param>
5252
/// <returns>The value the setting currently contains.</returns>
53-
string GetSetting(string key);
53+
string? GetSetting(string key);
5454

5555
/// <summary>
5656
/// Add or replace a setting in the configuration.
5757
/// </summary>
5858
/// <param name="key">The key of the setting to add or replace.</param>
5959
/// <param name="value">The value of the setting to add or replace.</param>
6060
/// <returns>The <see cref="IWebHostBuilder"/>.</returns>
61-
IWebHostBuilder UseSetting(string key, string value);
61+
IWebHostBuilder UseSetting(string key, string? value);
6262
}
63-
}
63+
}

src/Hosting/Abstractions/src/Microsoft.AspNetCore.Hosting.Abstractions.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
99
<PackageTags>aspnetcore;hosting</PackageTags>
1010
<IsPackable>false</IsPackable>
11+
<Nullable>enable</Nullable>
1112
</PropertyGroup>
1213

1314
<ItemGroup>

src/Hosting/Abstractions/src/WebHostBuilderContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public class WebHostBuilderContext
1313
/// <summary>
1414
/// The <see cref="IWebHostEnvironment" /> initialized by the <see cref="IWebHost" />.
1515
/// </summary>
16-
public IWebHostEnvironment HostingEnvironment { get; set; }
16+
public IWebHostEnvironment HostingEnvironment { get; set; } = default!;
1717

1818
/// <summary>
1919
/// The <see cref="IConfiguration" /> containing the merged configuration of the application and the <see cref="IWebHost" />.
2020
/// </summary>
21-
public IConfiguration Configuration { get; set; }
21+
public IConfiguration Configuration { get; set; } = default!;
2222
}
2323
}

0 commit comments

Comments
 (0)