-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Enable nullable: Microsoft.PowerShell.Commands.IRegistryWrapper #14177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,29 +17,31 @@ | |
|
||
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(); | ||
|
||
void DeleteValue(string name); | ||
|
||
string[] GetSubKeyNames(); | ||
|
||
IRegistryWrapper CreateSubKey(string subkey); | ||
IRegistryWrapper? CreateSubKey(string subkey); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is null returned when create fails? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
IRegistryWrapper OpenSubKey(string name, bool writable); | ||
IRegistryWrapper? OpenSubKey(string name, bool writable); | ||
|
||
void DeleteSubKeyTree(string subkey); | ||
|
||
object GetValue(string name); | ||
object? GetValue(string? name); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is null returned when the key doesn't exist? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
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 | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean to set a null-named key in the registry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From docs: https://docs.microsoft.com/en-us/dotnet/api/microsoft.win32.registrykey.setvalue?view=net-5.0#Microsoft_Win32_RegistryKey_SetValue_System_String_System_Object_