From b45ee9d37afec0c88141053e86ccf71c6f283000 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Mon, 17 Aug 2020 14:53:18 -0700 Subject: [PATCH] Remove ObsoletedInOSPlatformAttribute (#40945) --- .../Runtime/Versioning/PlatformAttributes.cs | 37 ---------------------- src/libraries/System.Runtime/ref/System.Runtime.cs | 8 ----- .../Runtime/Versioning/OSPlatformAttributeTests.cs | 14 -------- 3 files changed, 59 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs index 0f99e44..66564c1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs @@ -74,43 +74,6 @@ namespace System.Runtime.Versioning } /// - /// Marks APIs that were obsoleted in a given operating system version. - /// - /// Primarily used by OS bindings to indicate APIs that should only be used in - /// earlier versions. - /// - [AttributeUsage(AttributeTargets.Assembly | - AttributeTargets.Class | - AttributeTargets.Constructor | - AttributeTargets.Enum | - AttributeTargets.Event | - AttributeTargets.Field | - AttributeTargets.Method | - AttributeTargets.Module | - AttributeTargets.Property | - AttributeTargets.Struct, - AllowMultiple = true, Inherited = false)] -#if SYSTEM_PRIVATE_CORELIB - public -#else - internal -#endif - sealed class ObsoletedInOSPlatformAttribute : OSPlatformAttribute - { - public ObsoletedInOSPlatformAttribute(string platformName) : base(platformName) - { - } - - public ObsoletedInOSPlatformAttribute(string platformName, string message) : base(platformName) - { - Message = message; - } - - public string? Message { get; } - public string? Url { get; set; } - } - - /// /// Marks APIs that were removed in a given operating system version. /// /// diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index ef8bbb7..b347edf 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -9998,14 +9998,6 @@ namespace System.Runtime.Versioning { public SupportedOSPlatformAttribute(string platformName) : base(platformName) { } } - [System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] - public sealed class ObsoletedInOSPlatformAttribute : System.Runtime.Versioning.OSPlatformAttribute - { - public ObsoletedInOSPlatformAttribute(string platformName) : base(platformName) { } - public ObsoletedInOSPlatformAttribute(string platformName, string message) : base(platformName) { } - public string? Message { get; } - public string? Url { get; set; } - } public abstract class OSPlatformAttribute : System.Attribute { private protected OSPlatformAttribute(string platformName) { } diff --git a/src/libraries/System.Runtime/tests/System/Runtime/Versioning/OSPlatformAttributeTests.cs b/src/libraries/System.Runtime/tests/System/Runtime/Versioning/OSPlatformAttributeTests.cs index af507a5..4167455 100644 --- a/src/libraries/System.Runtime/tests/System/Runtime/Versioning/OSPlatformAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System/Runtime/Versioning/OSPlatformAttributeTests.cs @@ -20,20 +20,6 @@ namespace System.Runtime.Versioning.Tests } [Theory] - [InlineData("Windows8.0", "Obsolete", "http://test.com/obsoletedInOSPlatform")] - [InlineData("Linux", "Message", null)] - [InlineData("iOS13", null, null)] - [InlineData("", null, "http://test.com/obsoletedInOSPlatform")] - public void TestObsoletedInOSPlatformAttribute(string platformName, string message, string url) - { - var opa = message == null ? new ObsoletedInOSPlatformAttribute(platformName) { Url = url} : new ObsoletedInOSPlatformAttribute(platformName, message) { Url = url }; - - Assert.Equal(platformName, opa.PlatformName); - Assert.Equal(message, opa.Message); - Assert.Equal(url, opa.Url); - } - - [Theory] [InlineData("Windows8.0")] [InlineData("Android4.1")] [InlineData("")] -- 2.7.4