private static bool ShowInStackTrace(MethodBase mb)
{
Debug.Assert(mb != null);
- return !(mb.IsDefined(typeof(StackTraceHiddenAttribute)) || (mb.DeclaringType?.IsDefined(typeof(StackTraceHiddenAttribute)) ?? false));
+
+ if (mb.MethodImplementationFlags.HasFlag(MethodImplAttributes.AggressiveInlining))
+ {
+ // Aggressive Inlines won't normally show in the StackTrace; however for Tier0 Jit and
+ // cross-assembly AoT/R2R these inlines will be blocked until Tier1 Jit re-Jits
+ // them when they will inline. We don't show them in the StackTrace to bring consitency
+ // between this first-pass asm and fully optimized asm.
+ return false;
+ }
+
+ if (mb.IsDefined(typeof(StackTraceHiddenAttribute), inherit: false))
+ {
+ // Don't show where StackTraceHidden is applied to the method.
+ return false;
+ }
+
+ Type? declaringType = mb.DeclaringType;
+ // Methods don't always have containing types, for example dynamic RefEmit generated methods.
+ if (declaringType != null &&
+ declaringType.IsDefined(typeof(StackTraceHiddenAttribute), inherit: false))
+ {
+ // Don't show where StackTraceHidden is applied to the containing Type of the method.
+ return false;
+ }
+
+ return true;
}
private static bool TryResolveStateMachineMethod(ref MethodBase method, out Type declaringType)
/// <summary>Gets the result of the ValueTask.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- [StackTraceHidden]
public void GetResult() => _value.ThrowIfCompletedUnsuccessfully();
/// <summary>Schedules the continuation action for the <see cref="ConfiguredValueTaskAwaitable"/>.</summary>
/// <summary>Gets the result of the ValueTask.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- [StackTraceHidden]
public TResult GetResult() => _value.Result;
/// <summary>Schedules the continuation action for the <see cref="ConfiguredValueTaskAwaitable{TResult}"/>.</summary>
}
/// <summary>Gets the result of the ValueTask.</summary>
- [StackTraceHidden]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetResult() => _value.ThrowIfCompletedUnsuccessfully();
}
/// <summary>Gets the result of the ValueTask.</summary>
- [StackTraceHidden]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public TResult GetResult() => _value.Result;
[ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)]
public Utf8String Slice(int startIndex, int length) => Substring(startIndex, length);
-
- [StackTraceHidden]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void ValidateStartIndexAndLength(int startIndex, int length)
{