diff --git a/src/Shared/ThrowHelpers/ArgumentNullThrowHelper.cs b/src/Shared/ThrowHelpers/ArgumentNullThrowHelper.cs
index fd0129fb3..904072415 100644
--- a/src/Shared/ThrowHelpers/ArgumentNullThrowHelper.cs
+++ b/src/Shared/ThrowHelpers/ArgumentNullThrowHelper.cs
@@ -13,7 +13,7 @@ internal static partial class ArgumentNullThrowHelper
/// The name of the parameter with which corresponds.
public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
{
-#if !NET7_0_OR_GREATER
+#if !NET6_0_OR_GREATER
if (argument is null)
{
Throw(paramName);
@@ -23,7 +23,7 @@ public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpres
#endif
}
-#if !NET7_0_OR_GREATER
+#if !NET6_0_OR_GREATER
[DoesNotReturn]
internal static void Throw(string? paramName) =>
throw new ArgumentNullException(paramName);