From 612b9b301b8be3a9be037b196d24efcb606c194e Mon Sep 17 00:00:00 2001 From: Staffan Gustafsson Date: Fri, 20 Nov 2020 00:40:25 +0100 Subject: [PATCH 1/2] Enable nullable: Microsoft.PowerShell.Commands.IRegistryWrapper --- .../namespaces/RegistryWrapper.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/System.Management.Automation/namespaces/RegistryWrapper.cs b/src/System.Management.Automation/namespaces/RegistryWrapper.cs index 0e8e0558312..0b14c2c811c 100644 --- a/src/System.Management.Automation/namespaces/RegistryWrapper.cs +++ b/src/System.Management.Automation/namespaces/RegistryWrapper.cs @@ -17,11 +17,14 @@ 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 +32,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; } @@ -54,6 +57,8 @@ internal interface IRegistryWrapper int SubKeyCount { get; } } +#nullable restore + internal static class RegistryWrapperUtils { public static object ConvertValueToUIntFromRegistryIfNeeded(string name, object value, RegistryValueKind kind) From 0bff675d2eb954af98549b026d8f3ac810f0d0fb Mon Sep 17 00:00:00 2001 From: Staffan Gustafsson Date: Fri, 20 Nov 2020 19:03:10 +0100 Subject: [PATCH 2/2] Removing whitespace before/after nullable pragma --- src/System.Management.Automation/namespaces/RegistryWrapper.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/System.Management.Automation/namespaces/RegistryWrapper.cs b/src/System.Management.Automation/namespaces/RegistryWrapper.cs index 0b14c2c811c..ebdbe833839 100644 --- a/src/System.Management.Automation/namespaces/RegistryWrapper.cs +++ b/src/System.Management.Automation/namespaces/RegistryWrapper.cs @@ -19,7 +19,6 @@ namespace Microsoft.PowerShell.Commands { #nullable enable - internal interface IRegistryWrapper { void SetValue(string? name, object value); @@ -56,7 +55,6 @@ internal interface IRegistryWrapper int SubKeyCount { get; } } - #nullable restore internal static class RegistryWrapperUtils