Skip to content

Commit

Permalink
Add StackTraceHidden to the ThrowIfNull helper on .NET >= 6
Browse files Browse the repository at this point in the history
  • Loading branch information
brantburnett committed Jan 8, 2025
1 parent eccdd01 commit 2fb8208
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/Yardarm.Client/Internal/ThrowHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

Expand All @@ -18,7 +19,10 @@ public static void ThrowInvalidOperationException(string? message) =>
/// <summary>Throws an <see cref="ArgumentNullException"/> if <paramref name="argument"/> is null.</summary>
/// <param name="argument">The reference type argument to validate as non-null.</param>
/// <param name="paramName">The name of the parameter with which <paramref name="argument"/> corresponds.</param>
public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
#if NET6_0_OR_GREATER
[StackTraceHidden]
#endif
public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
{
#if NET6_0_OR_GREATER
// Forward to the common implementation
Expand Down

0 comments on commit 2fb8208

Please sign in to comment.