diff --git a/src/libraries/Microsoft.Extensions.Configuration.Ini/ref/Microsoft.Extensions.Configuration.Ini.cs b/src/libraries/Microsoft.Extensions.Configuration.Ini/ref/Microsoft.Extensions.Configuration.Ini.cs index 9a73882b9e3a7..e23fd718f00d7 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Ini/ref/Microsoft.Extensions.Configuration.Ini.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Ini/ref/Microsoft.Extensions.Configuration.Ini.cs @@ -8,8 +8,8 @@ namespace Microsoft.Extensions.Configuration { public static partial class IniConfigurationExtensions { - public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddIniFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, Microsoft.Extensions.FileProviders.IFileProvider provider, string path, bool optional, bool reloadOnChange) { throw null; } - public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddIniFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, System.Action configureSource) { throw null; } + public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddIniFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, Microsoft.Extensions.FileProviders.IFileProvider? provider, string path, bool optional, bool reloadOnChange) { throw null; } + public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddIniFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, System.Action? configureSource) { throw null; } public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddIniFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path) { throw null; } public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddIniFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path, bool optional) { throw null; } public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddIniFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path, bool optional, bool reloadOnChange) { throw null; } @@ -32,7 +32,7 @@ public partial class IniStreamConfigurationProvider : Microsoft.Extensions.Confi { public IniStreamConfigurationProvider(Microsoft.Extensions.Configuration.Ini.IniStreamConfigurationSource source) : base (default(Microsoft.Extensions.Configuration.StreamConfigurationSource)) { } public override void Load(System.IO.Stream stream) { } - public static System.Collections.Generic.IDictionary Read(System.IO.Stream stream) { throw null; } + public static System.Collections.Generic.IDictionary Read(System.IO.Stream stream) { throw null; } } public partial class IniStreamConfigurationSource : Microsoft.Extensions.Configuration.StreamConfigurationSource { diff --git a/src/libraries/Microsoft.Extensions.Configuration.Ini/ref/Microsoft.Extensions.Configuration.Ini.csproj b/src/libraries/Microsoft.Extensions.Configuration.Ini/ref/Microsoft.Extensions.Configuration.Ini.csproj index 7d73ff499998a..a4ee6a2df9438 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Ini/ref/Microsoft.Extensions.Configuration.Ini.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration.Ini/ref/Microsoft.Extensions.Configuration.Ini.csproj @@ -1,6 +1,7 @@ $(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) + enable diff --git a/src/libraries/Microsoft.Extensions.Configuration.Ini/src/IniConfigurationExtensions.cs b/src/libraries/Microsoft.Extensions.Configuration.Ini/src/IniConfigurationExtensions.cs index 259417495a1d1..ab5442a919575 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Ini/src/IniConfigurationExtensions.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Ini/src/IniConfigurationExtensions.cs @@ -62,7 +62,7 @@ public static IConfigurationBuilder AddIniFile(this IConfigurationBuilder builde /// Whether the file is optional. /// Whether the configuration should be reloaded if the file changes. /// The . - public static IConfigurationBuilder AddIniFile(this IConfigurationBuilder builder, IFileProvider provider, string path, bool optional, bool reloadOnChange) + public static IConfigurationBuilder AddIniFile(this IConfigurationBuilder builder, IFileProvider? provider, string path, bool optional, bool reloadOnChange) { if (builder == null) { @@ -89,7 +89,7 @@ public static IConfigurationBuilder AddIniFile(this IConfigurationBuilder builde /// The to add to. /// Configures the source. /// The . - public static IConfigurationBuilder AddIniFile(this IConfigurationBuilder builder, Action configureSource) + public static IConfigurationBuilder AddIniFile(this IConfigurationBuilder builder, Action? configureSource) => builder.Add(configureSource); /// diff --git a/src/libraries/Microsoft.Extensions.Configuration.Ini/src/IniStreamConfigurationProvider.cs b/src/libraries/Microsoft.Extensions.Configuration.Ini/src/IniStreamConfigurationProvider.cs index ac71fc18f8507..9b010dc476267 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Ini/src/IniStreamConfigurationProvider.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Ini/src/IniStreamConfigurationProvider.cs @@ -23,16 +23,16 @@ public IniStreamConfigurationProvider(IniStreamConfigurationSource source) : bas /// /// The stream of INI data. /// The which was read from the stream. - public static IDictionary Read(Stream stream) + public static IDictionary Read(Stream stream) { - var data = new Dictionary(StringComparer.OrdinalIgnoreCase); + var data = new Dictionary(StringComparer.OrdinalIgnoreCase); using (var reader = new StreamReader(stream)) { string sectionPrefix = string.Empty; while (reader.Peek() != -1) { - string rawLine = reader.ReadLine(); + string rawLine = reader.ReadLine()!; // Since Peak didn't return -1, stream hasn't ended. string line = rawLine.Trim(); // Ignore blank lines @@ -41,7 +41,7 @@ public static IDictionary Read(Stream stream) continue; } // Ignore comments - if (line[0] == ';' || line[0] == '#' || line[0] == '/') + if (line[0] is ';' or '#' or '/') { continue; } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Ini/src/Microsoft.Extensions.Configuration.Ini.csproj b/src/libraries/Microsoft.Extensions.Configuration.Ini/src/Microsoft.Extensions.Configuration.Ini.csproj index 7b0a14abec59c..a212999573c80 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Ini/src/Microsoft.Extensions.Configuration.Ini.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration.Ini/src/Microsoft.Extensions.Configuration.Ini.csproj @@ -2,6 +2,7 @@ $(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) + enable true false