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
3 changes: 3 additions & 0 deletions src/libraries/Common/src/System/Obsoletions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@ internal static class Obsoletions

internal const string WebRequestMessage = "Use HttpClient instead.";
internal const string WebRequestDiagId = "SYSLIB0014";

internal const string DisablePrivateReflectionAttributeMessage = "DisablePrivateReflectionAttribute has no effect in .NET Core and .NET 5.0+ applications.";
Copy link
Member

Choose a reason for hiding this comment

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

This attribute still has effect in a few corner cases in CoreCLR. Search for DisablePrivateReflection under src\coreclr and delete everything found.

Copy link
Member

Choose a reason for hiding this comment

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

Also, we may want to say .NET 6.0+ in the error message.

internal const string DisablePrivateReflectionAttributeDiagId = "SYSLIB0015";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace System.Runtime.CompilerServices
{
[Obsolete(Obsoletions.DisablePrivateReflectionAttributeMessage, DiagnosticId = Obsoletions.DisablePrivateReflectionAttributeDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[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 = "SYSLIB0015", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class DisablePrivateReflectionAttribute : System.Attribute
{
Expand Down