-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Group 2] Enable nullable annotations for Microsoft.Extensions.Configuration.Abstractions
#57401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
bcc0fa2
8a85d25
e02fcb5
1156491
3beb005
a630248
49d6e40
9fe1f65
1c9f837
0e77967
5b990d6
7621595
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,16 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks> | ||
| <TargetFrameworks>$(NetCoreAppCurrent);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks> | ||
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Compile Include="Microsoft.Extensions.Configuration.Abstractions.cs" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Primitives\ref\Microsoft.Extensions.Primitives.csproj" /> | ||
| </ItemGroup> | ||
| <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'"> | ||
maxkoshevoi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <ProjectReference Include="$(LibrariesProjectRoot)System.Collections\ref\System.Collections.csproj" /> | ||
| <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\ref\System.Runtime.csproj" /> | ||
| </ItemGroup> | ||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace Microsoft.Extensions.Configuration | ||
| { | ||
|
|
@@ -49,7 +50,8 @@ public static string Combine(IEnumerable<string> pathSegments) | |
| /// </summary> | ||
| /// <param name="path">The path.</param> | ||
| /// <returns>The last path segment of the path.</returns> | ||
| public static string GetSectionKey(string path) | ||
| [return: NotNullIfNotNull("path")] | ||
| public static string? GetSectionKey(string? path) | ||
| { | ||
| if (string.IsNullOrEmpty(path)) | ||
| { | ||
|
|
@@ -65,7 +67,7 @@ public static string GetSectionKey(string path) | |
| /// </summary> | ||
| /// <param name="path">The path.</param> | ||
| /// <returns>The original path minus the last individual segment found in it. Null if the original path corresponds to a top level node.</returns> | ||
| public static string GetParentPath(string path) | ||
| public static string? GetParentPath(string? path) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. honestly I think
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also don't have a strong opinion. One benefit of making I didn't find any calls to this method here or in aspnet, so don't know how this method it used. |
||
| { | ||
| if (string.IsNullOrEmpty(path)) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,6 @@ public interface IConfigurationSection : IConfiguration | |
| /// <summary> | ||
| /// Gets or sets the section value. | ||
| /// </summary> | ||
| string Value { get; set; } | ||
| string? Value { get; set; } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you decide to keep path as nullable arg in other places should this also accept nullable path?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. Also all usages don't expect
Regarding leaving |
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.