Skip to content

Commit 9896a25

Browse files
committed
Fix argument helpers for netstandard and netfx
1 parent 1e6f3e4 commit 9896a25

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/Shared/ThrowHelpers/ArgumentNullThrowHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal static partial class ArgumentNullThrowHelper
1616
/// <param name="paramName">The name of the parameter with which <paramref name="argument"/> corresponds.</param>
1717
public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
1818
{
19-
#if !NET7_0_OR_GREATER
19+
#if !NET7_0_OR_GREATER || NETSTANDARD ||NETFRAMEWORK
2020
if (argument is null)
2121
{
2222
Throw(paramName);
@@ -26,7 +26,7 @@ public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpres
2626
#endif
2727
}
2828

29-
#if !NET7_0_OR_GREATER
29+
#if !NET7_0_OR_GREATER || NETSTANDARD ||NETFRAMEWORK
3030
[DoesNotReturn]
3131
internal static void Throw(string? paramName) =>
3232
throw new ArgumentNullException(paramName);

src/Shared/ThrowHelpers/ArgumentThrowHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Shared;
1111

1212
internal static partial class ArgumentThrowHelper
1313
{
14-
#if !NET7_0_OR_GREATER
14+
#if !NET7_0_OR_GREATER || NETSTANDARD ||NETFRAMEWORK
1515
private const string EmptyString = "";
1616
#endif
1717

@@ -20,7 +20,7 @@ internal static partial class ArgumentThrowHelper
2020
/// <param name="paramName">The name of the parameter with which <paramref name="argument"/> corresponds.</param>
2121
public static void ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumentExpression("argument")] string? paramName = null)
2222
{
23-
#if !NET7_0_OR_GREATER
23+
#if !NET7_0_OR_GREATER || NETSTANDARD ||NETFRAMEWORK
2424
if (argument is null or EmptyString)
2525
{
2626
ArgumentNullThrowHelper.ThrowIfNull(argument);
@@ -31,7 +31,7 @@ public static void ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumen
3131
#endif
3232
}
3333

34-
#if !NET7_0_OR_GREATER
34+
#if !NET7_0_OR_GREATER || NETSTANDARD ||NETFRAMEWORK
3535
[DoesNotReturn]
3636
internal static void Throw(string? paramName) =>
3737
throw new ArgumentException("The value cannot be an empty string.", paramName);

src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<Compile Include="$(SignalRSharedSourceRoot)Utf8BufferTextWriter.cs" Link="Internal\Utf8BufferTextWriter.cs" />
2020
<Compile Include="$(SignalRSharedSourceRoot)ReusableUtf8JsonWriter.cs" Link="Internal\ReusableUtf8JsonWriter.cs" />
2121
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentThrowHelper.cs" LinkBase="Shared" />
22+
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
2223
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
2324
</ItemGroup>
2425

0 commit comments

Comments
 (0)