-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Nullable annotate for Microsoft.Win32.Registry #2351
Nullable annotate for Microsoft.Win32.Registry #2351
Conversation
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
Outdated
Show resolved
Hide resolved
Please hold off from merging, Microsoft.Win32.Registry has a dependency on |
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
Show resolved
Hide resolved
src/libraries/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistrySecurity.cs
Outdated
Show resolved
Hide resolved
|
6f42d9d
to
0bd572b
Compare
@eiriktsarpalis Have I done the correct thing? |
@manne please update files for Linux / Mac versions too, if you are using VS change your project context to Linux/OSX respectively to see the files in VS |
There seem to be nullability related build errors on windows too. They might be related to the newly annotated dependencies. |
Hi @manne, and thank you for your contribution. What is the status of this PR? As part of our ongoing annotation work we are looking to get this project done asap. Will you able to complete it soon? If not, would you mind if we took this over, either by creating a separate PR or pushing commits to your branch? |
@eiriktsarpalis I am working on it right now |
0bd572b
to
2ac937d
Compare
@@ -83,22 +82,20 @@ private void FlushCore() | |||
} | |||
} | |||
|
|||
private unsafe RegistryKey CreateSubKeyInternalCore(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions) | |||
private unsafe RegistryKey? CreateSubKeyInternalCore(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions) |
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.
Looks like the return type is annotated as nullable on account of the code path on line 121. But it seems clear by the assertion above that this is not expected to happen unless there is a bug. I think non-nullability should be asserted.
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.
Good point, if this not return null then all public RegistryKey CreateSubKey(...)
overloads not return null
{ | ||
int type = 0; | ||
int datasize = 0; | ||
int ret = Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, (byte[])null, ref datasize); | ||
int ret = Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, (byte[])null!, ref datasize); |
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.
int ret = Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, (byte[])null!, ref datasize); | |
int ret = Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, (byte[]?)null, ref datasize); |
public Microsoft.Win32.RegistryKey? CreateSubKey(string subkey, Microsoft.Win32.RegistryKeyPermissionCheck permissionCheck, Microsoft.Win32.RegistryOptions registryOptions, System.Security.AccessControl.RegistrySecurity? registrySecurity) { throw null; } | ||
public Microsoft.Win32.RegistryKey? CreateSubKey(string subkey, Microsoft.Win32.RegistryKeyPermissionCheck permissionCheck, System.Security.AccessControl.RegistrySecurity? registrySecurity) { throw null; } | ||
public Microsoft.Win32.RegistryKey? CreateSubKey(string subkey, bool writable) { throw null; } | ||
public Microsoft.Win32.RegistryKey? CreateSubKey(string subkey, bool writable, Microsoft.Win32.RegistryOptions options) { throw null; } |
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.
As per @eiriktsarpalis's comment https://github.com/dotnet/runtime/pull/2351/files#r378221011 all this CreateSubKey(...)
overloads not return null
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.
Except @eiriktsarpalis's comment and updates related to that change overall looks great, thank you @manne
LGTM. If you could just fix the merge conflicts we should be ready to merge your changes. Thank you! |
Thx |
Contributes to #2339