# Microsoft.Extensions.Options

``` diff
 namespace Microsoft.Extensions.Options {
     public class ConfigurationChangeTokenSource<TOptions> : IOptionsChangeTokenSource<TOptions> {
-        public ConfigurationChangeTokenSource(string name, IConfiguration config);
+        public ConfigurationChangeTokenSource(string? name, IConfiguration config);
     }
     public class ConfigureFromConfigurationOptions<TOptions> : ConfigureOptions<TOptions> where TOptions : class {
         [RequiresUnreferencedCodeAttribute("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
         public ConfigureFromConfigurationOptions(IConfiguration config);
     }
     public class ConfigureNamedOptions<TOptions> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class {
-        public ConfigureNamedOptions(string name, Action<TOptions> action);
+        public ConfigureNamedOptions(string? name, Action<TOptions>? action);
-        public Action<TOptions> Action { get; }
+        public Action<TOptions>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void Configure(string name, TOptions options);
+        public virtual void Configure(string? name, TOptions options);
     }
     public class ConfigureNamedOptions<TOptions, TDep> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep : class {
-        public ConfigureNamedOptions(string name, TDep dependency, Action<TOptions, TDep> action);
+        public ConfigureNamedOptions(string? name, TDep dependency, Action<TOptions, TDep>? action);
-        public Action<TOptions, TDep> Action { get; }
+        public Action<TOptions, TDep>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void Configure(string name, TOptions options);
+        public virtual void Configure(string? name, TOptions options);
     }
     public class ConfigureNamedOptions<TOptions, TDep1, TDep2> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class {
-        public ConfigureNamedOptions(string name, TDep1 dependency, TDep2 dependency2, Action<TOptions, TDep1, TDep2> action);
+        public ConfigureNamedOptions(string? name, TDep1 dependency, TDep2 dependency2, Action<TOptions, TDep1, TDep2>? action);
-        public Action<TOptions, TDep1, TDep2> Action { get; }
+        public Action<TOptions, TDep1, TDep2>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void Configure(string name, TOptions options);
+        public virtual void Configure(string? name, TOptions options);
     }
     public class ConfigureNamedOptions<TOptions, TDep1, TDep2, TDep3> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class {
-        public ConfigureNamedOptions(string name, TDep1 dependency, TDep2 dependency2, TDep3 dependency3, Action<TOptions, TDep1, TDep2, TDep3> action);
+        public ConfigureNamedOptions(string? name, TDep1 dependency, TDep2 dependency2, TDep3 dependency3, Action<TOptions, TDep1, TDep2, TDep3>? action);
-        public Action<TOptions, TDep1, TDep2, TDep3> Action { get; }
+        public Action<TOptions, TDep1, TDep2, TDep3>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void Configure(string name, TOptions options);
+        public virtual void Configure(string? name, TOptions options);
     }
     public class ConfigureNamedOptions<TOptions, TDep1, TDep2, TDep3, TDep4> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class {
-        public ConfigureNamedOptions(string name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, Action<TOptions, TDep1, TDep2, TDep3, TDep4> action);
+        public ConfigureNamedOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, Action<TOptions, TDep1, TDep2, TDep3, TDep4>? action);
-        public Action<TOptions, TDep1, TDep2, TDep3, TDep4> Action { get; }
+        public Action<TOptions, TDep1, TDep2, TDep3, TDep4>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void Configure(string name, TOptions options);
+        public virtual void Configure(string? name, TOptions options);
     }
     public class ConfigureNamedOptions<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class where TDep5 : class {
-        public ConfigureNamedOptions(string name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5, Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> action);
+        public ConfigureNamedOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5, Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>? action);
-        public Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> Action { get; }
+        public Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void Configure(string name, TOptions options);
+        public virtual void Configure(string? name, TOptions options);
     }
     public class ConfigureOptions<TOptions> : IConfigureOptions<TOptions> where TOptions : class {
-        public ConfigureOptions(Action<TOptions> action);
+        public ConfigureOptions(Action<TOptions>? action);
-        public Action<TOptions> Action { get; }
+        public Action<TOptions>? Action { get; }
     }
     public class DataAnnotationValidateOptions<TOptions> : IValidateOptions<TOptions> where TOptions : class {
         [RequiresUnreferencedCodeAttribute("The implementation of Validate method on this type will walk through all properties of the passed in options object, and its type cannot be statically analyzed so its members may be trimmed.")]
         public DataAnnotationValidateOptions(string name);
-        public ValidateOptionsResult Validate(string name, TOptions options);
+        public ValidateOptionsResult Validate(string? name, TOptions options);
     }
     public interface IConfigureNamedOptions<in TOptions> : IConfigureOptions<TOptions> where TOptions : class {
-        void Configure(string name, TOptions options);
+        void Configure(string? name, TOptions options);
     }
     public interface IOptionsMonitor<out TOptions> {
-        TOptions Get(string name);
+        TOptions Get(string? name);
-        IDisposable OnChange(Action<TOptions, string> listener);
+        IDisposable? OnChange(Action<TOptions, string?> listener);
     }
     public interface IOptionsMonitorCache<TOptions> where TOptions : class {
-        TOptions GetOrAdd(string name, Func<TOptions> createOptions);
+        TOptions GetOrAdd(string? name, Func<TOptions> createOptions);
-        bool TryAdd(string name, TOptions options);
+        bool TryAdd(string? name, TOptions options);
-        bool TryRemove(string name);
+        bool TryRemove(string? name);
     }
     public interface IOptionsSnapshot<out TOptions> : IOptions<TOptions> where TOptions : class {
-        TOptions Get(string name);
+        TOptions Get(string? name);
     }
     public interface IPostConfigureOptions<in TOptions> where TOptions : class {
-        void PostConfigure(string name, TOptions options);
+        void PostConfigure(string? name, TOptions options);
     }
     public interface IValidateOptions<TOptions> where TOptions : class {
-        ValidateOptionsResult Validate(string name, TOptions options);
+        ValidateOptionsResult Validate(string? name, TOptions options);
     }
     public class NamedConfigureFromConfigurationOptions<TOptions> : ConfigureNamedOptions<TOptions> where TOptions : class {
-        [RequiresUnreferencedCodeAttribute("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
-        public NamedConfigureFromConfigurationOptions(string name, IConfiguration config);
+        [RequiresUnreferencedCodeAttribute("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
+        public NamedConfigureFromConfigurationOptions(string? name, IConfiguration config);
-        [RequiresUnreferencedCodeAttribute("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
-        public NamedConfigureFromConfigurationOptions(string name, IConfiguration config, Action<BinderOptions> configureBinder);
+        [RequiresUnreferencedCodeAttribute("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
+        public NamedConfigureFromConfigurationOptions(string? name, IConfiguration config, Action<BinderOptions>? configureBinder);
     }
     public class OptionsBuilder<TOptions> where TOptions : class {
-        public OptionsBuilder(IServiceCollection services, string name);
+        public OptionsBuilder(IServiceCollection services, string? name);
     }
     public class OptionsCache<TOptions> : IOptionsMonitorCache<TOptions> where TOptions : class {
-        public virtual TOptions GetOrAdd(string name, Func<TOptions> createOptions);
+        public virtual TOptions GetOrAdd(string? name, Func<TOptions> createOptions);
-        public virtual bool TryAdd(string name, TOptions options);
+        public virtual bool TryAdd(string? name, TOptions options);
-        public virtual bool TryRemove(string name);
+        public virtual bool TryRemove(string? name);
     }
     public class OptionsManager<TOptions> : IOptions<TOptions>, IOptionsSnapshot<TOptions> where TOptions : class {
-        public virtual TOptions Get(string name);
+        public virtual TOptions Get(string? name);
     }
     public class OptionsMonitor<TOptions> : IDisposable, IOptionsMonitor<TOptions> where TOptions : class {
-        public virtual TOptions Get(string name);
+        public virtual TOptions Get(string? name);
     }
     public static class OptionsMonitorExtensions {
-        public static IDisposable OnChange<TOptions>(this IOptionsMonitor<TOptions> monitor, Action<TOptions> listener);
+        public static IDisposable? OnChange<TOptions>(this IOptionsMonitor<TOptions> monitor, Action<TOptions> listener);
     }
     public class OptionsValidationException : Exception {
-        public OptionsValidationException(string optionsName, Type optionsType, IEnumerable<string> failureMessages);
+        public OptionsValidationException(string optionsName, Type optionsType, IEnumerable<string>? failureMessages);
     }
     public class PostConfigureOptions<TOptions> : IPostConfigureOptions<TOptions> where TOptions : class {
-        public PostConfigureOptions(string name, Action<TOptions> action);
+        public PostConfigureOptions(string name, Action<TOptions>? action);
-        public Action<TOptions> Action { get; }
+        public Action<TOptions>? Action { get; }
-        public virtual void PostConfigure(string name, TOptions options);
+        public virtual void PostConfigure(string? name, TOptions options);
     }
     public class PostConfigureOptions<TOptions, TDep> : IPostConfigureOptions<TOptions> where TOptions : class where TDep : class {
-        public PostConfigureOptions(string name, TDep dependency, Action<TOptions, TDep> action);
+        public PostConfigureOptions(string? name, TDep dependency, Action<TOptions, TDep>? action);
-        public Action<TOptions, TDep> Action { get; }
+        public Action<TOptions, TDep>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void PostConfigure(string name, TOptions options);
+        public virtual void PostConfigure(string? name, TOptions options);
     }
     public class PostConfigureOptions<TOptions, TDep1, TDep2> : IPostConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class {
-        public PostConfigureOptions(string name, TDep1 dependency, TDep2 dependency2, Action<TOptions, TDep1, TDep2> action);
+        public PostConfigureOptions(string? name, TDep1 dependency, TDep2 dependency2, Action<TOptions, TDep1, TDep2>? action);
-        public Action<TOptions, TDep1, TDep2> Action { get; }
+        public Action<TOptions, TDep1, TDep2>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void PostConfigure(string name, TOptions options);
+        public virtual void PostConfigure(string? name, TOptions options);
     }
     public class PostConfigureOptions<TOptions, TDep1, TDep2, TDep3> : IPostConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class {
-        public PostConfigureOptions(string name, TDep1 dependency, TDep2 dependency2, TDep3 dependency3, Action<TOptions, TDep1, TDep2, TDep3> action);
+        public PostConfigureOptions(string? name, TDep1 dependency, TDep2 dependency2, TDep3 dependency3, Action<TOptions, TDep1, TDep2, TDep3>? action);
-        public Action<TOptions, TDep1, TDep2, TDep3> Action { get; }
+        public Action<TOptions, TDep1, TDep2, TDep3>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void PostConfigure(string name, TOptions options);
+        public virtual void PostConfigure(string? name, TOptions options);
     }
     public class PostConfigureOptions<TOptions, TDep1, TDep2, TDep3, TDep4> : IPostConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class {
-        public PostConfigureOptions(string name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, Action<TOptions, TDep1, TDep2, TDep3, TDep4> action);
+        public PostConfigureOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, Action<TOptions, TDep1, TDep2, TDep3, TDep4>? action);
-        public Action<TOptions, TDep1, TDep2, TDep3, TDep4> Action { get; }
+        public Action<TOptions, TDep1, TDep2, TDep3, TDep4>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void PostConfigure(string name, TOptions options);
+        public virtual void PostConfigure(string? name, TOptions options);
     }
     public class PostConfigureOptions<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> : IPostConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class where TDep5 : class {
-        public PostConfigureOptions(string name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5, Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> action);
+        public PostConfigureOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5, Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>? action);
-        public Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> Action { get; }
+        public Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>? Action { get; }
-        public string Name { get; }
+        public string? Name { get; }
-        public virtual void PostConfigure(string name, TOptions options);
+        public virtual void PostConfigure(string? name, TOptions options);
     }
     public class ValidateOptions<TOptions> : IValidateOptions<TOptions> where TOptions : class {
-        public ValidateOptions(string name, Func<TOptions, bool> validation, string failureMessage);
+        public ValidateOptions(string? name, Func<TOptions, bool> validation, string failureMessage);
-        public string Name { get; }
+        public string? Name { get; }
-        public ValidateOptionsResult Validate(string name, TOptions options);
+        public ValidateOptionsResult Validate(string? name, TOptions options);
     }
     public class ValidateOptions<TOptions, TDep> : IValidateOptions<TOptions> where TOptions : class {
-        public ValidateOptions(string name, TDep dependency, Func<TOptions, TDep, bool> validation, string failureMessage);
+        public ValidateOptions(string? name, TDep dependency, Func<TOptions, TDep, bool> validation, string failureMessage);
-        public string Name { get; }
+        public string? Name { get; }
-        public ValidateOptionsResult Validate(string name, TOptions options);
+        public ValidateOptionsResult Validate(string? name, TOptions options);
     }
     public class ValidateOptions<TOptions, TDep1, TDep2> : IValidateOptions<TOptions> where TOptions : class {
-        public ValidateOptions(string name, TDep1 dependency1, TDep2 dependency2, Func<TOptions, TDep1, TDep2, bool> validation, string failureMessage);
+        public ValidateOptions(string? name, TDep1 dependency1, TDep2 dependency2, Func<TOptions, TDep1, TDep2, bool> validation, string failureMessage);
-        public string Name { get; }
+        public string? Name { get; }
-        public ValidateOptionsResult Validate(string name, TOptions options);
+        public ValidateOptionsResult Validate(string? name, TOptions options);
     }
     public class ValidateOptions<TOptions, TDep1, TDep2, TDep3> : IValidateOptions<TOptions> where TOptions : class {
-        public ValidateOptions(string name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, Func<TOptions, TDep1, TDep2, TDep3, bool> validation, string failureMessage);
+        public ValidateOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, Func<TOptions, TDep1, TDep2, TDep3, bool> validation, string failureMessage);
-        public string Name { get; }
+        public string? Name { get; }
-        public ValidateOptionsResult Validate(string name, TOptions options);
+        public ValidateOptionsResult Validate(string? name, TOptions options);
     }
     public class ValidateOptions<TOptions, TDep1, TDep2, TDep3, TDep4> : IValidateOptions<TOptions> where TOptions : class {
-        public ValidateOptions(string name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, Func<TOptions, TDep1, TDep2, TDep3, TDep4, bool> validation, string failureMessage);
+        public ValidateOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, Func<TOptions, TDep1, TDep2, TDep3, TDep4, bool> validation, string failureMessage);
-        public string Name { get; }
+        public string? Name { get; }
-        public ValidateOptionsResult Validate(string name, TOptions options);
+        public ValidateOptionsResult Validate(string? name, TOptions options);
     }
     public class ValidateOptions<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> : IValidateOptions<TOptions> where TOptions : class {
-        public ValidateOptions(string name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5, Func<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5, bool> validation, string failureMessage);
+        public ValidateOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5, Func<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5, bool> validation, string failureMessage);
-        public string Name { get; }
+        public string? Name { get; }
-        public ValidateOptionsResult Validate(string name, TOptions options);
+        public ValidateOptionsResult Validate(string? name, TOptions options);
     }
     public class ValidateOptionsResult {
-        public bool Failed { get; protected set; }
+        [MemberNotNullWhenAttribute(true, "FailureMessage")]
+        [MemberNotNullWhenAttribute(true, "Failures")]
+        public bool Failed { [MemberNotNullWhenAttribute(true, "FailureMessage"), MemberNotNullWhenAttribute(true, "Failures")] get; [MemberNotNullWhenAttribute(true, "FailureMessage"), MemberNotNullWhenAttribute(true, "Failures")] protected set; }
-        public string FailureMessage { get; protected set; }
+        public string? FailureMessage { get; protected set; }
-        public IEnumerable<string> Failures { get; protected set; }
+        public IEnumerable<string>? Failures { get; protected set; }
     }
 }
```

