Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpres
}
}

internal static void ThrowIfNull([NotNull] object? argument, ExceptionArgument paramName)
{
if (argument is null)
{
ThrowHelper.ThrowArgumentNullException(paramName);
}
}

/// <summary>Throws an <see cref="ArgumentNullException"/> if <paramref name="argument"/> is null.</summary>
/// <param name="argument">The pointer argument to validate as non-null.</param>
/// <param name="paramName">The name of the parameter with which <paramref name="argument"/> corresponds.</param>
Expand Down
18 changes: 18 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ internal static void ThrowArgumentException_DestinationTooShort()
throw new ArgumentException(SR.Argument_DestinationTooShort, "destination");
}

[DoesNotReturn]
internal static void ThrowArgumentException_InvalidTimeSpanStyles()
{
throw new ArgumentException(SR.Argument_InvalidTimeSpanStyles, "styles");
}

[DoesNotReturn]
internal static void ThrowArgumentException_OverlapAlignmentMismatch()
{
Expand Down Expand Up @@ -224,12 +230,24 @@ internal static void ThrowOverflowException()
throw new OverflowException();
}

[DoesNotReturn]
internal static void ThrowOverflowException_NegateTwosCompNum()
{
throw new OverflowException(SR.Overflow_NegateTwosCompNum);
}

[DoesNotReturn]
internal static void ThrowOverflowException_TimeSpanTooLong()
{
throw new OverflowException(SR.Overflow_TimeSpanTooLong);
}

[DoesNotReturn]
internal static void ThrowOverflowException_TimeSpanDuration()
{
throw new OverflowException(SR.Overflow_Duration);
}

[DoesNotReturn]
internal static void ThrowArgumentException_Arg_CannotBeNaN()
{
Expand Down
Loading