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 33// See the LICENSE file in the project root for more information.
44
55using System ;
6+ using System . Diagnostics ;
67using System . Diagnostics . CodeAnalysis ;
78
89namespace CommunityToolkit . Diagnostics ;
@@ -15,6 +16,7 @@ public static partial class Guard
1516 /// <summary>
1617 /// Helper methods to efficiently throw exceptions.
1718 /// </summary>
19+ [ StackTraceHidden ]
1820 private static partial class ThrowHelper
1921 {
2022 /// <summary>
You can’t perform that action at this time.
0 commit comments