Skip to content

Commit

Permalink
Allow DynamicallyAccessedMembersAttribute on methods (dotnet#36340)
Browse files Browse the repository at this point in the history
Allow DynamicallyAccessedMembersAttribute on methods
  • Loading branch information
vitek-karas authored May 29, 2020
1 parent 45b0d0b commit 55b8180
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ namespace System.Diagnostics.CodeAnalysis
///
/// When this attribute is applied to a location of type <see cref="string"/>, the assumption is
/// that the string represents a fully qualified type name.
///
/// If the attribute is applied to a method it's treated as a special case and it implies
/// the attribute should be applied to the "this" parameter of the method. As such the attribute
/// should only be used on instance methods of types assignable to System.Type (or string, but no methods
/// will use it there).
/// </remarks>
[AttributeUsage(
AttributeTargets.Field | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter |
AttributeTargets.Parameter | AttributeTargets.Property,
AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Method,
Inherited = false)]
public sealed class DynamicallyAccessedMembersAttribute : Attribute
{
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5628,7 +5628,7 @@ public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, st
public string? AssemblyName { get { throw null; } }
public string? Condition { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.GenericParameter | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited = false)]
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.GenericParameter | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited = false)]
public sealed class DynamicallyAccessedMembersAttribute : System.Attribute
{
public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes) { }
Expand Down

0 comments on commit 55b8180

Please sign in to comment.