Skip to content

Commit

Permalink
Expose the RequiresLocationAttribute (dotnet#89870)
Browse files Browse the repository at this point in the history
* Expose the RequiresLocationAttribute

* Add a basic test for RequiresLocationAttribute
  • Loading branch information
tannergooding authored Aug 11, 2023
1 parent 624c48d commit 678fd6a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\PreserveBaseOverridesAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RefSafetyRulesAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RequiredMemberAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RequiresLocationAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RuntimeCompatibilityAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RuntimeFeature.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RuntimeFeature.NonNativeAot.cs" Condition="'$(FeatureNativeAot)' != 'true'" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.ComponentModel;

namespace System.Runtime.CompilerServices
{
/// <summary>
/// Reserved for use by a compiler for tracking metadata.
/// This attribute should not be used by developers in source code.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
public sealed class RequiresLocationAttribute : Attribute
{
/// <summary>Initializes the attribute.</summary>
public RequiresLocationAttribute()
{
}
}
}
6 changes: 6 additions & 0 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13046,6 +13046,12 @@ public sealed class RequiredMemberAttribute : System.Attribute
{
public RequiredMemberAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class RequiresLocationAttribute : System.Attribute
{
public RequiresLocationAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false)]
public sealed partial class ReferenceAssemblyAttribute : System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,5 +393,11 @@ public static void CompilerFeatureRequiredTests()
Assert.Equal("feature2", attr2.FeatureName);
Assert.True(attr2.IsOptional);
}

[Fact]
public static void RequiresLocationAttributeTests()
{
new RequiresLocationAttribute();
}
}
}

0 comments on commit 678fd6a

Please sign in to comment.