Open
Description
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