diff --git a/src/System.Management.Automation/namespaces/RegistryWrapper.cs b/src/System.Management.Automation/namespaces/RegistryWrapper.cs index 0e8e0558312..ebdbe833839 100644 --- a/src/System.Management.Automation/namespaces/RegistryWrapper.cs +++ b/src/System.Management.Automation/namespaces/RegistryWrapper.cs @@ -17,11 +17,13 @@ namespace Microsoft.PowerShell.Commands { + +#nullable enable internal interface IRegistryWrapper { - void SetValue(string name, object value); + void SetValue(string? name, object value); - void SetValue(string name, object value, RegistryValueKind valueKind); + void SetValue(string? name, object value, RegistryValueKind valueKind); string[] GetValueNames(); @@ -29,17 +31,17 @@ internal interface IRegistryWrapper string[] GetSubKeyNames(); - IRegistryWrapper CreateSubKey(string subkey); + IRegistryWrapper? CreateSubKey(string subkey); - IRegistryWrapper OpenSubKey(string name, bool writable); + IRegistryWrapper? OpenSubKey(string name, bool writable); void DeleteSubKeyTree(string subkey); - object GetValue(string name); + object? GetValue(string? name); - object GetValue(string name, object defaultValue, RegistryValueOptions options); + object? GetValue(string? name, object? defaultValue, RegistryValueOptions options); - RegistryValueKind GetValueKind(string name); + RegistryValueKind GetValueKind(string? name); object RegistryKey { get; } @@ -53,6 +55,7 @@ internal interface IRegistryWrapper int SubKeyCount { get; } } +#nullable restore internal static class RegistryWrapperUtils {