diff --git a/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/System.Private.CoreLib.csproj
index e75a0fc2e4f3..29811fa6d755 100644
--- a/src/System.Private.CoreLib/System.Private.CoreLib.csproj
+++ b/src/System.Private.CoreLib/System.Private.CoreLib.csproj
@@ -25,7 +25,9 @@
true
4
true
- 649,1573,1591,0419,BCL0020
+
+ 649,1573,1591,0419,BCL0020,CS8609
false
true
true
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Win32.cs b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Win32.cs
index d0b645ec1c35..02e38e22edb2 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Win32.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Win32.cs
@@ -55,10 +55,10 @@ private static int GetAdvanceHijriDate()
}
int hijriAdvance = 0;
- string str = value.ToString();
+ string? str = value.ToString();
if (string.Compare(str, 0, HijriAdvanceRegKeyEntry, 0, HijriAdvanceRegKeyEntry.Length, StringComparison.OrdinalIgnoreCase) == 0)
{
- if (str.Length == HijriAdvanceRegKeyEntry.Length)
+ if (str!.Length == HijriAdvanceRegKeyEntry.Length)
hijriAdvance = -1;
else
{
diff --git a/src/System.Private.CoreLib/shared/System/Object.cs b/src/System.Private.CoreLib/shared/System/Object.cs
index 10af793ca6ab..2bdb5c545ab7 100644
--- a/src/System.Private.CoreLib/shared/System/Object.cs
+++ b/src/System.Private.CoreLib/shared/System/Object.cs
@@ -36,7 +36,7 @@ public Object()
// Returns a String which represents the object instance. The default
// for an object is to return the fully qualified name of the class.
- public virtual string ToString()
+ public virtual string? ToString()
{
return GetType().ToString();
}
diff --git a/src/System.Private.CoreLib/shared/System/String.Manipulation.cs b/src/System.Private.CoreLib/shared/System/String.Manipulation.cs
index bd56d0c33af0..dc7f01591bb0 100644
--- a/src/System.Private.CoreLib/shared/System/String.Manipulation.cs
+++ b/src/System.Private.CoreLib/shared/System/String.Manipulation.cs
@@ -34,14 +34,7 @@ private static unsafe void FillStringChecked(string dest, int destPos, string sr
}
}
- public static string Concat(object? arg0)
- {
- if (arg0 == null)
- {
- return string.Empty;
- }
- return arg0.ToString();
- }
+ public static string Concat(object? arg0) => arg0?.ToString() ?? string.Empty;
public static string Concat(object? arg0, object? arg1)
{