File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change 3
3
// See the LICENSE file in the project root for more information.
4
4
5
5
using System ;
6
+ using System . Diagnostics ;
6
7
using System . Diagnostics . CodeAnalysis ;
7
8
8
9
namespace CommunityToolkit . Diagnostics ;
@@ -15,6 +16,7 @@ public static partial class Guard
15
16
/// <summary>
16
17
/// Helper methods to efficiently throw exceptions.
17
18
/// </summary>
19
+ [ StackTraceHidden ]
18
20
private static partial class ThrowHelper
19
21
{
20
22
/// <summary>
You can’t perform that action at this time.
0 commit comments