{
public static partial class XmlConfigurationExtensions
{
- public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile(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 AddXmlFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, System.Action<Microsoft.Extensions.Configuration.Xml.XmlConfigurationSource> configureSource) { throw null; }
+ public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile(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 AddXmlFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, System.Action<Microsoft.Extensions.Configuration.Xml.XmlConfigurationSource>? configureSource) { throw null; }
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path) { throw null; }
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path, bool optional) { throw null; }
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddXmlFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path, bool optional, bool reloadOnChange) { throw null; }
{
public static readonly Microsoft.Extensions.Configuration.Xml.XmlDocumentDecryptor Instance;
protected XmlDocumentDecryptor() { }
- public System.Xml.XmlReader CreateDecryptingXmlReader(System.IO.Stream input, System.Xml.XmlReaderSettings settings) { throw null; }
+ public System.Xml.XmlReader CreateDecryptingXmlReader(System.IO.Stream input, System.Xml.XmlReaderSettings? settings) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
protected virtual System.Xml.XmlReader DecryptDocumentAndCreateXmlReader(System.Xml.XmlDocument document) { throw null; }
}
{
public XmlStreamConfigurationProvider(Microsoft.Extensions.Configuration.Xml.XmlStreamConfigurationSource source) : base (default(Microsoft.Extensions.Configuration.StreamConfigurationSource)) { }
public override void Load(System.IO.Stream stream) { }
- public static System.Collections.Generic.IDictionary<string, string> Read(System.IO.Stream stream, Microsoft.Extensions.Configuration.Xml.XmlDocumentDecryptor decryptor) { throw null; }
+ public static System.Collections.Generic.IDictionary<string, string?> Read(System.IO.Stream stream, Microsoft.Extensions.Configuration.Xml.XmlDocumentDecryptor decryptor) { throw null; }
}
public partial class XmlStreamConfigurationSource : Microsoft.Extensions.Configuration.StreamConfigurationSource
{
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
+ <Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
+ <Nullable>enable</Nullable>
<EnableDefaultItems>true</EnableDefaultItems>
<!-- Use targeting pack references instead of granular ones in the project file. -->
<DisableImplicitAssemblyReferences>false</DisableImplicitAssemblyReferences>
{
public string ElementName { get; }
- public string Name { get; }
+ public string? Name { get; }
/// <summary>
/// A composition of ElementName and Name, that serves as the basis for detecting siblings
/// <summary>
/// The children of this element
/// </summary>
- public IDictionary<string, List<XmlConfigurationElement>> ChildrenBySiblingName { get; set; }
+ public IDictionary<string, List<XmlConfigurationElement>>? ChildrenBySiblingName { get; set; }
/// <summary>
/// Performance optimization: do not initialize a dictionary and a list for elements with a single child
/// </summary>
- public XmlConfigurationElement SingleChild { get; set; }
+ public XmlConfigurationElement? SingleChild { get; set; }
- public XmlConfigurationElementTextContent TextContent { get; set; }
+ public XmlConfigurationElementTextContent? TextContent { get; set; }
- public List<XmlConfigurationElementAttributeValue> Attributes { get; set; }
+ public List<XmlConfigurationElementAttributeValue>? Attributes { get; set; }
- public XmlConfigurationElement(string elementName!!, string name)
+ public XmlConfigurationElement(string elementName!!, string? name)
{
ElementName = elementName;
Name = name;
/// <param name="optional">Whether the file is optional.</param>
/// <param name="reloadOnChange">Whether the configuration should be reloaded if the file changes.</param>
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
- public static IConfigurationBuilder AddXmlFile(this IConfigurationBuilder builder!!, IFileProvider provider, string path, bool optional, bool reloadOnChange)
+ public static IConfigurationBuilder AddXmlFile(this IConfigurationBuilder builder!!, IFileProvider? provider, string path, bool optional, bool reloadOnChange)
{
if (string.IsNullOrEmpty(path))
{
/// <param name="builder">The <see cref="IConfigurationBuilder"/> to add to.</param>
/// <param name="configureSource">Configures the source.</param>
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
- public static IConfigurationBuilder AddXmlFile(this IConfigurationBuilder builder, Action<XmlConfigurationSource> configureSource)
+ public static IConfigurationBuilder AddXmlFile(this IConfigurationBuilder builder, Action<XmlConfigurationSource>? configureSource)
=> builder.Add(configureSource);
/// <summary>
/// </summary>
public static readonly XmlDocumentDecryptor Instance = new XmlDocumentDecryptor();
- private readonly Func<XmlDocument, EncryptedXml> _encryptedXmlFactory;
+ private readonly Func<XmlDocument, EncryptedXml>? _encryptedXmlFactory;
/// <summary>
/// Initializes a XmlDocumentDecryptor.
/// <summary>
/// Returns an XmlReader that decrypts data transparently.
/// </summary>
- public XmlReader CreateDecryptingXmlReader(Stream input, XmlReaderSettings settings)
+ public XmlReader CreateDecryptingXmlReader(Stream input, XmlReaderSettings? settings)
{
// XML-based configurations aren't really all that big, so we can buffer
// the whole thing in memory while we determine decryption operations.
// Finally, return the new XmlReader from the updated XmlDocument.
// Error messages based on this XmlReader won't show line numbers,
// but that's fine since we transformed the document anyway.
- return document.CreateNavigator().ReadSubtree();
+ return document.CreateNavigator()!.ReadSubtree();
}
}
}
/// <param name="stream">The stream of XML data.</param>
/// <param name="decryptor">The <see cref="XmlDocumentDecryptor"/> to use to decrypt.</param>
/// <returns>The <see cref="IDictionary{String, String}"/> which was read from the stream.</returns>
- public static IDictionary<string, string> Read(Stream stream, XmlDocumentDecryptor decryptor)
+ public static IDictionary<string, string?> Read(Stream stream, XmlDocumentDecryptor decryptor)
{
var readerSettings = new XmlReaderSettings()
{
IgnoreWhitespace = true
};
- XmlConfigurationElement root = null;
+ XmlConfigurationElement? root = null;
using (XmlReader reader = decryptor.CreateDecryptingXmlReader(stream, readerSettings))
{
throw new FormatException(SR.Format(SR.Error_NamespaceIsNotSupported, GetLineInfo(reader)));
}
- element.Attributes.Add(new XmlConfigurationElementAttributeValue(reader.LocalName, reader.Value, lineNumber, linePosition));
+ element.Attributes!.Add(new XmlConfigurationElementAttributeValue(reader.LocalName, reader.Value, lineNumber, linePosition));
}
// Go back to the element containing the attributes we just processed
// The special attribute "Name" only contributes to prefix
// This method retrieves the Name of the element, if the attribute is present
// Unfortunately XmlReader.GetAttribute cannot be used, as it does not support looking for attributes in a case insensitive manner
- private static string GetName(XmlReader reader)
+ private static string? GetName(XmlReader reader)
{
- string name = null;
+ string? name = null;
while (reader.MoveToNextAttribute())
{
return name;
}
- private static IDictionary<string, string> ProvideConfiguration(XmlConfigurationElement root)
+ private static IDictionary<string, string?> ProvideConfiguration(XmlConfigurationElement? root)
{
- var configuration = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+ Dictionary<string, string?> configuration = new(StringComparer.OrdinalIgnoreCase);
if (root == null)
{