Skip to content

Commit 32ac9c8

Browse files
teo-tsirpanisSergio0694
authored andcommitted
Copy .NET 9 attribute sources from dotnet/runtime.
1 parent d519f71 commit 32ac9c8

6 files changed

+153
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
4+
namespace System.Diagnostics.CodeAnalysis
5+
{
6+
/// <summary>
7+
/// Indicates that the specified public static boolean get-only property
8+
/// guards access to the specified feature.
9+
/// </summary>
10+
/// <remarks>
11+
/// Analyzers can use this to prevent warnings on calls to code that is
12+
/// annotated as requiring that feature, when the callsite is guarded by a
13+
/// call to the property.
14+
/// </remarks>
15+
[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
16+
#if SYSTEM_PRIVATE_CORELIB
17+
public
18+
#else
19+
internal
20+
#endif
21+
sealed class FeatureGuardAttribute : Attribute
22+
{
23+
/// <summary>
24+
/// Initializes a new instance of the <see cref="FeatureGuardAttribute"/> class
25+
/// with the specified feature type.
26+
/// </summary>
27+
/// <param name="featureType">
28+
/// The type that represents the feature guarded by the property.
29+
/// </param>
30+
public FeatureGuardAttribute(Type featureType)
31+
{
32+
FeatureType = featureType;
33+
}
34+
35+
/// <summary>
36+
/// The type that represents the feature guarded by the property.
37+
/// </summary>
38+
public Type FeatureType { get; }
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
4+
namespace System.Diagnostics.CodeAnalysis
5+
{
6+
/// <summary>
7+
/// Indicates that the specified public static boolean get-only property
8+
/// corresponds to the feature switch specified by name.
9+
/// </summary>
10+
/// <remarks>
11+
/// IL rewriters and compilers can use this to substitute the return value
12+
/// of the specified property with the value of the feature switch.
13+
/// </remarks>
14+
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
15+
#if SYSTEM_PRIVATE_CORELIB
16+
public
17+
#else
18+
internal
19+
#endif
20+
sealed class FeatureSwitchDefinitionAttribute : Attribute
21+
{
22+
/// <summary>
23+
/// Initializes a new instance of the <see cref="FeatureSwitchDefinitionAttribute"/> class
24+
/// with the specified feature switch name.
25+
/// </summary>
26+
/// <param name="switchName">
27+
/// The name of the feature switch that provides the value for the specified property.
28+
/// </param>
29+
public FeatureSwitchDefinitionAttribute(string switchName)
30+
{
31+
SwitchName = switchName;
32+
}
33+
34+
/// <summary>
35+
/// The name of the feature switch that provides the value for the specified property.
36+
/// </summary>
37+
public string SwitchName { get; }
38+
}
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
4+
namespace System.Diagnostics
5+
{
6+
/// <summary>
7+
/// If a .NET Debugger is attached which supports the Debugger.BreakForUserUnhandledException(Exception) API,
8+
/// this attribute will prevent the debugger from breaking on user-unhandled exceptions when the
9+
/// exception is caught by a method with this attribute, unless BreakForUserUnhandledException is called.
10+
/// </summary>
11+
[AttributeUsage(AttributeTargets.Method)]
12+
public sealed class DebuggerDisableUserUnhandledExceptionsAttribute : Attribute
13+
{
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
4+
namespace System.Runtime.InteropServices
5+
{
6+
/// <summary>
7+
/// Specifies that the P/Invoke marked with this attribute should be linked in as a WASM import.
8+
/// </summary>
9+
/// <remarks>
10+
/// See https://webassembly.github.io/spec/core/syntax/modules.html#imports.
11+
/// </remarks>
12+
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
13+
public sealed class WasmImportLinkageAttribute : Attribute
14+
{
15+
/// <summary>
16+
/// Instance constructor.
17+
/// </summary>
18+
public WasmImportLinkageAttribute() { }
19+
}
20+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
4+
namespace System.Runtime.CompilerServices
5+
{
6+
/// <summary>
7+
/// Specifies the priority of a member in overload resolution. When unspecified, the default priority is 0.
8+
/// </summary>
9+
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
10+
public sealed class OverloadResolutionPriorityAttribute : Attribute
11+
{
12+
/// <summary>
13+
/// Initializes a new instance of the <see cref="OverloadResolutionPriorityAttribute"/> class.
14+
/// </summary>
15+
/// <param name="priority">The priority of the attributed member. Higher numbers are prioritized, lower numbers are deprioritized. 0 is the default if no attribute is present.</param>
16+
public OverloadResolutionPriorityAttribute(int priority)
17+
{
18+
Priority = priority;
19+
}
20+
21+
/// <summary>
22+
/// The priority of the member.
23+
/// </summary>
24+
public int Priority { get; }
25+
}
26+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
4+
namespace System.Runtime.CompilerServices
5+
{
6+
/// <summary>
7+
/// Indicates that a method will allow a variable number of arguments in its invocation.
8+
/// </summary>
9+
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
10+
public sealed class ParamCollectionAttribute : Attribute
11+
{
12+
}
13+
}

0 commit comments

Comments
 (0)