Skip to content

Commit

Permalink
Remove ObsoletedInOSPlatformAttribute (dotnet#40945)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffhandley authored Aug 17, 2020
1 parent 6c05d93 commit b45ee9d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,43 +73,6 @@ public SupportedOSPlatformAttribute (string platformName) : base(platformName)
}
}

/// <summary>
/// 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.
/// </summary>
[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; }
}

/// <summary>
/// Marks APIs that were removed in a given operating system version.
/// </summary>
Expand Down
8 changes: 0 additions & 8 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9998,14 +9998,6 @@ public sealed class SupportedOSPlatformAttribute : System.Runtime.Versioning.OSP
{
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) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ public void TestTargetPlatformAttribute(string platformName)
Assert.Equal(platformName, tpa.PlatformName);
}

[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")]
Expand Down

0 comments on commit b45ee9d

Please sign in to comment.