diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets
index 83a2e140326c1..4bee9c66ea207 100644
--- a/src/libraries/Directory.Build.targets
+++ b/src/libraries/Directory.Build.targets
@@ -253,6 +253,19 @@
+
+
+
+
+
+
+
+
+ $(NoWarn);CS0436
+
+
+
+
diff --git a/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.cs b/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.cs
index e19e3c253e9dd..b14173fb6c6ef 100644
--- a/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.cs
+++ b/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.cs
@@ -259,6 +259,7 @@ public DirectoryServicesCOMException(string message, System.Exception inner) { }
public string ExtendedErrorMessage { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
}
+ [System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public sealed partial class DirectoryServicesPermission : System.Security.Permissions.ResourcePermissionBase
{
public DirectoryServicesPermission() { }
@@ -274,6 +275,7 @@ public enum DirectoryServicesPermissionAccess
Browse = 2,
Write = 6,
}
+ [System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public partial class DirectoryServicesPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute
{
diff --git a/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.csproj b/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.csproj
index 68593ef6e13eb..a29cfa079c933 100644
--- a/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.csproj
+++ b/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.csproj
@@ -1,6 +1,7 @@
netstandard2.0
+ true
diff --git a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
index fe5b6232d96ab..7751f4e3d475a 100644
--- a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
+++ b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
@@ -3,6 +3,7 @@
true
$(NetCoreAppCurrent)-Windows_NT;netstandard2.0;netcoreapp2.0-Windows_NT
true
+ true
@@ -135,6 +136,7 @@
+
diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesPermission.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesPermission.cs
index 7b1ebc03ec5eb..27cab3be2254c 100644
--- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesPermission.cs
+++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesPermission.cs
@@ -5,9 +5,7 @@
namespace System.DirectoryServices
{
-#pragma warning disable SYSLIB0003
- // Conditionally marking this type as obsolete in .NET 5+ will require diverging its net5.0 build from netstandard2.0
- // https://github.com/dotnet/runtime/issues/39413
+ [Obsolete(Obsoletions.CodeAccessSecurityMessage, DiagnosticId = Obsoletions.CodeAccessSecurityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
public sealed class DirectoryServicesPermission : ResourcePermissionBase
{
public DirectoryServicesPermission() { }
@@ -16,5 +14,4 @@ public DirectoryServicesPermission(PermissionState state) { }
public DirectoryServicesPermission(DirectoryServicesPermissionAccess permissionAccess, string path) { }
public DirectoryServicesPermissionEntryCollection PermissionEntries { get; }
}
-#pragma warning restore SYSLIB0003
}
diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesPermissionAttribute.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesPermissionAttribute.cs
index b4d094115b5bd..43c3986daeaa9 100644
--- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesPermissionAttribute.cs
+++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesPermissionAttribute.cs
@@ -6,9 +6,7 @@
namespace System.DirectoryServices
{
-#pragma warning disable SYSLIB0003
- // Conditionally marking this type as obsolete in .NET 5+ will require diverging its net5.0 build from netstandard2.0
- // https://github.com/dotnet/runtime/issues/39413
+ [Obsolete(Obsoletions.CodeAccessSecurityMessage, DiagnosticId = Obsoletions.CodeAccessSecurityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Event,
AllowMultiple = true, Inherited = false)]
@@ -19,5 +17,4 @@ public DirectoryServicesPermissionAttribute(SecurityAction action) : base(defaul
public string Path { get; set; }
public override IPermission CreatePermission() { return default(IPermission); }
}
-#pragma warning restore SYSLIB0003
}
diff --git a/src/libraries/System.Private.CoreLib/src/System/ObsoleteAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/ObsoleteAttribute.cs
index 11a2777e85068..05dfed0844b12 100644
--- a/src/libraries/System.Private.CoreLib/src/System/ObsoleteAttribute.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/ObsoleteAttribute.cs
@@ -24,7 +24,13 @@ namespace System
[AttributeUsage(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
+#if SYSTEM_PRIVATE_CORELIB
+ public
+#else
+#nullable enable
+ internal
+#endif
+ sealed class ObsoleteAttribute : Attribute
{
public ObsoleteAttribute()
{