Skip to content

Commit 78c381f

Browse files
committed
Add [StackTraceHidden] polyfill
1 parent e9be820 commit 78c381f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
#if !NET6_0_OR_GREATER
6+
7+
namespace System.Diagnostics;
8+
9+
/// <summary>
10+
/// Removes annotated methods from the stacktrace in case an exception occurrs while they're on the stack.
11+
/// </summary>
12+
/// <remarks>
13+
/// This is a port of the attribute from the BCL in .NET 6, and it's marked as conditional so that it will
14+
/// be removed for package builds that are released on NuGet. This attribute is only used internally to
15+
/// avoid having to clutter the codebase with many compiler directive switches to check for this API.
16+
/// </remarks>
17+
[Conditional("DEBUG")]
18+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Struct, Inherited = false)]
19+
internal sealed class StackTraceHiddenAttribute : Attribute
20+
{
21+
}
22+
23+
#endif

0 commit comments

Comments
 (0)