Skip to content

[API Proposal]: Allow ObsoleteAttribute to target assemblies to enable marking entire assembly as obsolete #114259

Open
@scharnyw

Description

@scharnyw

Background and motivation

This is a revisit of #23979 which seemed to have been given the go-ahead 7 years ago, but the change was never made.

It's occasionally desirable to mark entire assemblies as obsolete. But currently System.ObsoleteAttribute can only target types and type members. The alternative now is to mark every public type in the assembly as obsolete but this is inconvenient if your assembly contains a large number of types.

I understand that downstream tooling (e.g. Roslyn, etc.) may not recognize ObsoleteAttribute on assemblies for now but this change could precede such tooling updates.

API Proposal

namespace System;

[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum |
        AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property |
        AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate,
        Inherited = false)]
public sealed class ObsoleteAttribute : Attribute
{
    ...
}

API Usage

[assembly: Obsolete("This assembly is obsolete.")]

Alternative Designs

No response

Risks

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationarea-System.RuntimeuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions