Skip to content

API proposal: obsolete DisablePrivateReflectionAttribute #43247

Closed

Description

@GrabYourPitchforks

Per #11811, the runtime does not honor DisablePrivateReflectionAttribute, and there are no plans to restore this capability. We should obsolete the API.

namespace System.Runtime.CompilerServices
{
    [Obsolete("DisablePrivateReflectionAttribute has no effect in .NET Core and .NET 5.0+ applications.")] // NEW attribute
    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
    public sealed class DisablePrivateReflectionAttribute : Attribute
    {
        public DisablePrivateReflectionAttribute() { }
    }
}

I recommend using a normal [Obsolete] attribute with no diagnostic id since there's no real required reading here, nor should people really be suppressing this. They should just remove the attribute. There is no replacement mechanism to restore this functionality.

If we really wanted a diagnostic id and the whole breaking change rigamarole that it entails, we could use SYSLIB0013. I'll file a separate doc issue regardless of whether we use a unique diagnostic id here.

Activity

  1. added
    api-ready-for-review
    on Oct 10, 2020
  2. added
    untriaged
    on Oct 10, 2020
  3. added
    api-approved
    and removed
    api-ready-for-review
    on Oct 20, 2020
  4. terrajobst commented on Oct 20, 2020

    @terrajobst
    Contributor

    Video

    • We should use a diagnostic ID. This allows us to have a help-topic specific for this issue. SYSLIB0013 sounds yes. The topic seems to warrant that.
    • Other than that, looks good.
    namespace System.Runtime.CompilerServices
    {
        [Obsolete("DisablePrivateReflectionAttribute has no effect in .NET Core and .NET 5.0+ applications.")]
        public partial class DisablePrivateReflectionAttribute
        {
        }
    }
  5. added this to the Future milestone on Feb 16, 2021
  6. added
    help wanted
    and removed
    untriaged
    on Feb 16, 2021
  7. ghost added
    in-pr
    on Mar 12, 2021
  8. ghost removed
    in-pr
    on Mar 17, 2021
  9. ghost locked as resolved and limited conversation to collaborators on Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-approvedarea-System.Runtime.CompilerServiceshelp wanted

    Type

    No type

    Projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions