Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add obsolete attribute to DisablePrivateReflectionAttribute #49550

Merged
merged 15 commits into from
Mar 17, 2021
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace System.Runtime.CompilerServices
{
[Obsolete(Obsoletions.EscapeUriStringMessage, DiagnosticId = Obsoletions.EscapeUriStringDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a new message and new diagnostic ID for this particular obsoletion added to that file, and then those new values used here. It shouldn't use the existing ones, which aren't relevant to this API.

[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
public sealed class DisablePrivateReflectionAttribute : Attribute
{
Expand Down
1 change: 1 addition & 0 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9381,6 +9381,7 @@ public DependencyAttribute(string dependentAssemblyArgument, System.Runtime.Comp
public string DependentAssembly { get { throw null; } }
public System.Runtime.CompilerServices.LoadHint LoadHint { get { throw null; } }
}
[System.ObsoleteAttribute("DisablePrivateReflectionAttribute has no effect in .NET Core and .NET 5.0+ applications.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SYSLIB0013 is already taken. A new obsoletion ID is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was mentioned in the commentary on this issue, so I decided that it was necessary to use it. Thanks for the explanation. Can I take SYSLIB0015 instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope I did it right :)

[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class DisablePrivateReflectionAttribute : System.Attribute
{
Expand Down