diff --git a/eng/Versions.props b/eng/Versions.props
index b83e2dd249c0c5..7cc1a72696ed13 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -30,6 +30,8 @@
release, increase this number by one.
-->
0
+
+ 3.9.0-2.20516.4
");
s.Append(innerException.ToString());
}
string? stackTrace = StackTrace;
- if (stackTrace != null)
+ if (stackTrace is not null)
{
s.AppendLine();
s.Append(stackTrace);
diff --git a/src/libraries/Microsoft.Win32.Registry.AccessControl/src/Microsoft/Win32/RegistryAclExtensions.cs b/src/libraries/Microsoft.Win32.Registry.AccessControl/src/Microsoft/Win32/RegistryAclExtensions.cs
index ea3b3f88eb7481..e51284eeca112d 100644
--- a/src/libraries/Microsoft.Win32.Registry.AccessControl/src/Microsoft/Win32/RegistryAclExtensions.cs
+++ b/src/libraries/Microsoft.Win32.Registry.AccessControl/src/Microsoft/Win32/RegistryAclExtensions.cs
@@ -10,7 +10,7 @@ public static class RegistryAclExtensions
{
public static RegistrySecurity GetAccessControl(this RegistryKey key)
{
- if (key == null)
+ if (key is null)
throw new ArgumentNullException(nameof(key));
return key.GetAccessControl();
@@ -18,7 +18,7 @@ public static RegistrySecurity GetAccessControl(this RegistryKey key)
public static RegistrySecurity GetAccessControl(this RegistryKey key, AccessControlSections includeSections)
{
- if (key == null)
+ if (key is null)
throw new ArgumentNullException(nameof(key));
return key.GetAccessControl(includeSections);
@@ -26,7 +26,7 @@ public static RegistrySecurity GetAccessControl(this RegistryKey key, AccessCont
public static void SetAccessControl(this RegistryKey key, RegistrySecurity registrySecurity)
{
- if (key == null)
+ if (key is null)
throw new ArgumentNullException(nameof(key));
key.SetAccessControl(registrySecurity);
diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs
index 56cbc26afe977c..778706b3361e62 100644
--- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs
+++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs
@@ -35,7 +35,7 @@ public static class Registry
///
private static RegistryKey GetBaseKeyFromKeyName(string keyName, out string subKeyName)
{
- if (keyName == null)
+ if (keyName is null)
{
throw new ArgumentNullException(nameof(keyName));
}
@@ -55,7 +55,7 @@ private static RegistryKey GetBaseKeyFromKeyName(string keyName, out string subK
}
// If a potential base key was found, see if keyName actually starts with the potential base key's name.
- if (baseKey != null && keyName.StartsWith(baseKey.Name, StringComparison.OrdinalIgnoreCase))
+ if (baseKey is not null && keyName.StartsWith(baseKey.Name, StringComparison.OrdinalIgnoreCase))
{
subKeyName = (i == -1 || i == keyName.Length) ?
string.Empty :
@@ -88,7 +88,7 @@ public static void SetValue(string keyName, string? valueName, object value, Reg
using (RegistryKey? key = basekey.CreateSubKey(subKeyName))
{
- Debug.Assert(key != null, "An exception should be thrown if failed!");
+ Debug.Assert(key is not null, "An exception should be thrown if failed!");
key.SetValue(valueName, value, valueKind);
}
}
diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
index 16b3d1aecfbf1b..b9d41f8cc53ef2 100644
--- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
+++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
@@ -75,7 +75,7 @@ private void ClosePerfDataKey()
private void FlushCore()
{
- if (_hkey != null && IsDirty())
+ if (_hkey is not null && IsDirty())
{
Interop.Advapi32.RegFlushKey(_hkey);
}
@@ -513,7 +513,7 @@ private unsafe string[] GetValueNamesCore(int values)
}
finally
{
- if (name != null)
+ if (name is not null)
ArrayPool.Shared.Return(name);
}
@@ -750,7 +750,7 @@ private unsafe string[] GetValueNamesCore(int values)
}
cur = nextNull + 1;
- if (toAdd != null)
+ if (toAdd is not null)
{
if (strings.Length == stringsCount)
{
@@ -822,7 +822,7 @@ private unsafe void SetValueCore(string? name, object value, RegistryValueKind v
int sizeInChars = 1; // no matter what, we have the final null terminator.
for (int i = 0; i < dataStrings.Length; i++)
{
- if (dataStrings[i] == null)
+ if (dataStrings[i] is null)
{
throw new ArgumentException(SR.Arg_RegSetStrArrNull);
}
@@ -918,7 +918,7 @@ private void Win32Error(int errorCode, string? str)
switch (errorCode)
{
case Interop.Errors.ERROR_ACCESS_DENIED:
- throw str != null ?
+ throw str is not null ?
new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_RegistryKeyGeneric_Key, str)) :
new UnauthorizedAccessException();
@@ -951,7 +951,7 @@ private void Win32Error(int errorCode, string? str)
private static void Win32ErrorStatic(int errorCode, string? str) =>
throw errorCode switch
{
- Interop.Errors.ERROR_ACCESS_DENIED => str != null ?
+ Interop.Errors.ERROR_ACCESS_DENIED => str is not null ?
new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_RegistryKeyGeneric_Key, str)) :
new UnauthorizedAccessException(),
diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
index 54054d809c2847..35ed81ab4b611d 100644
--- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
+++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
@@ -98,7 +98,7 @@ public void Close()
public void Dispose()
{
- if (_hkey != null)
+ if (_hkey is not null)
{
if (!IsSystemKey())
{
@@ -167,7 +167,7 @@ public RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permis
if (!_remoteKey)
{
RegistryKey? key = InternalOpenSubKeyWithoutSecurityChecks(subkey, (permissionCheck != RegistryKeyPermissionCheck.ReadSubTree));
- if (key != null)
+ if (key is not null)
{
// Key already exits
key._checkMode = permissionCheck;
@@ -199,7 +199,7 @@ public void DeleteSubKey(string subkey, bool throwOnMissingSubKey)
// explicitly call close to avoid keeping an extra HKEY open.
//
RegistryKey? key = InternalOpenSubKeyWithoutSecurityChecks(subkey, false);
- if (key != null)
+ if (key is not null)
{
using (key)
{
@@ -243,7 +243,7 @@ public void DeleteSubKeyTree(string subkey, bool throwOnMissingSubKey)
subkey = FixupName(subkey); // Fixup multiple slashes to a single slash
RegistryKey? key = InternalOpenSubKeyWithoutSecurityChecks(subkey, true);
- if (key != null)
+ if (key is not null)
{
using (key)
{
@@ -273,7 +273,7 @@ public void DeleteSubKeyTree(string subkey, bool throwOnMissingSubKey)
private void DeleteSubKeyTreeInternal(string subkey)
{
RegistryKey? key = InternalOpenSubKeyWithoutSecurityChecks(subkey, true);
- if (key != null)
+ if (key is not null)
{
using (key)
{
@@ -325,7 +325,7 @@ public static RegistryKey OpenRemoteBaseKey(RegistryHive hKey, string machineNam
public static RegistryKey OpenRemoteBaseKey(RegistryHive hKey, string machineName, RegistryView view)
{
- if (machineName == null)
+ if (machineName is null)
{
throw new ArgumentNullException(nameof(machineName));
}
@@ -405,7 +405,7 @@ public RegistrySecurity GetAccessControl(AccessControlSections includeSections)
public void SetAccessControl(RegistrySecurity registrySecurity)
{
EnsureWriteable();
- if (registrySecurity == null)
+ if (registrySecurity is null)
{
throw new ArgumentNullException(nameof(registrySecurity));
}
@@ -449,7 +449,7 @@ public static RegistryKey FromHandle(SafeRegistryHandle handle)
public static RegistryKey FromHandle(SafeRegistryHandle handle, RegistryView view)
{
- if (handle == null) throw new ArgumentNullException(nameof(handle));
+ if (handle is null) throw new ArgumentNullException(nameof(handle));
ValidateKeyView(view);
return new RegistryKey(handle, writable: true, view: view);
@@ -559,12 +559,12 @@ public void SetValue(string? name, object value)
public void SetValue(string? name, object value, RegistryValueKind valueKind)
{
- if (value == null)
+ if (value is null)
{
throw new ArgumentNullException(nameof(value));
}
- if (name != null && name.Length > MaxValueLength)
+ if (name is not null && name.Length > MaxValueLength)
{
throw new ArgumentException(SR.Arg_RegValStrLenBug, nameof(name));
}
@@ -626,7 +626,7 @@ public override string ToString()
private static string FixupName(string name)
{
- Debug.Assert(name != null, "[FixupName]name!=null");
+ Debug.Assert(name is not null, "[FixupName]name!=null");
// string.Contains(char) is .NetCore2.1+ specific
if (name.IndexOf('\\') == -1)
@@ -647,7 +647,7 @@ private static string FixupName(string name)
private static void FixupPath(StringBuilder path)
{
- Debug.Assert(path != null);
+ Debug.Assert(path is not null);
int length = path.Length;
bool fixup = false;
@@ -690,7 +690,7 @@ private static void FixupPath(StringBuilder path)
private void EnsureNotDisposed()
{
- if (_hkey == null)
+ if (_hkey is null)
{
throw new ObjectDisposedException(_keyName, SR.ObjectDisposed_RegKeyClosed);
}
@@ -724,7 +724,7 @@ private RegistryKeyPermissionCheck GetSubKeyPermissionCheck(bool subkeyWritable)
private static void ValidateKeyName(string name)
{
- if (name == null)
+ if (name is null)
{
throw new ArgumentNullException(nameof(name));
}
diff --git a/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs b/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs
index ef4047801ab678..0830e09ea24a12 100644
--- a/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs
+++ b/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs
@@ -331,7 +331,7 @@ private static void AddEventHandler(object key, Delegate? value)
lock (s_eventLockObject)
{
- if (s_handlers == null)
+ if (s_handlers is null)
{
s_handlers = new Dictionary