From 9d6e592e39e6410760988fcf0370d03c6505959e Mon Sep 17 00:00:00 2001 From: Steve Harter Date: Wed, 8 Mar 2023 08:02:23 -0600 Subject: [PATCH] Remove S.S.Permissions reference from S.C.ConfigurationManager (#82259) --- .../ref/System.Configuration.ConfigurationManager.cs | 6 ++---- .../ref/System.Configuration.ConfigurationManager.csproj | 6 ++++-- .../src/System.Configuration.ConfigurationManager.csproj | 7 ++++--- .../System/Configuration/Internal/DelegatingConfigHost.cs | 3 +-- .../System/Configuration/Internal/IInternalConfigHost.cs | 3 +-- .../System/Configuration/Internal/InternalConfigHost.cs | 3 +-- .../netstandard/settings.targets | 6 ++++++ .../System.Runtime.Caching/netstandard/settings.targets | 6 ++++++ 8 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 src/libraries/testPackages/packageSettings/System.Configuration.ConfigurationManager/netstandard/settings.targets create mode 100644 src/libraries/testPackages/packageSettings/System.Runtime.Caching/netstandard/settings.targets diff --git a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs index 6d21ab559b502d..7ef3558b7f6649 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs @@ -1383,9 +1383,8 @@ public virtual void DeleteStream(string streamName) { } public virtual string GetConfigPathFromLocationSubPath(string configPath, string locationSubPath) { throw null; } public virtual System.Type GetConfigType(string typeName, bool throwOnError) { throw null; } public virtual string GetConfigTypeName(System.Type t) { throw null; } -#pragma warning disable SYSLIB0003 + [System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public virtual void GetRestrictedPermissions(System.Configuration.Internal.IInternalConfigRecord configRecord, out System.Security.PermissionSet permissionSet, out bool isHostReady) { throw null; } -#pragma warning restore SYSLIB0003 public virtual string GetStreamName(string configPath) { throw null; } public virtual string GetStreamNameForConfigSource(string streamName, string configSource) { throw null; } public virtual object GetStreamVersion(string streamName) { throw null; } @@ -1473,9 +1472,8 @@ public partial interface IInternalConfigHost string GetConfigPathFromLocationSubPath(string configPath, string locationSubPath); System.Type GetConfigType(string typeName, bool throwOnError); string GetConfigTypeName(System.Type t); -#pragma warning disable SYSLIB0003 + [System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] void GetRestrictedPermissions(System.Configuration.Internal.IInternalConfigRecord configRecord, out System.Security.PermissionSet permissionSet, out bool isHostReady); -#pragma warning restore SYSLIB0003 string GetStreamName(string configPath); string GetStreamNameForConfigSource(string streamName, string configSource); object GetStreamVersion(string streamName); diff --git a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj index bd9eab3ba5b119..cdd04d9ab8a1dd 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj +++ b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj @@ -3,6 +3,7 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) disable $(NoWarn);CS0618 + true @@ -12,8 +13,9 @@ - - + + + diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj b/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj index dae0fa151a3c71..7463343674be06 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj @@ -6,6 +6,7 @@ false false + true true Provides types that support using XML configuration files (app.config). This package exists only to support migrating existing .NET Framework code that already uses System.Configuration. When writing new code, use another configuration system instead, such as Microsoft.Extensions.Configuration. @@ -272,9 +273,9 @@ - - - + + + diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/DelegatingConfigHost.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/DelegatingConfigHost.cs index 46e588ce644c2e..5f26c3d9baf64c 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/DelegatingConfigHost.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/DelegatingConfigHost.cs @@ -231,12 +231,11 @@ public virtual void RefreshConfigPaths() public virtual IDisposable Impersonate() => new DummyDisposable(); -#pragma warning disable SYSLIB0003 // Obsolete: CAS + [System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public virtual void GetRestrictedPermissions(IInternalConfigRecord configRecord, out PermissionSet permissionSet, out bool isHostReady) { permissionSet = new PermissionSet(null); isHostReady = true; } -#pragma warning restore SYSLIB0003 // Obsolete: CAS } } diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/IInternalConfigHost.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/IInternalConfigHost.cs index b03989bfb87097..835e424d07ff18 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/IInternalConfigHost.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/IInternalConfigHost.cs @@ -103,8 +103,7 @@ string EncryptSection(string clearTextXml, ProtectedConfigurationProvider protec IDisposable Impersonate(); -#pragma warning disable SYSLIB0003 // Obsolete: CAS + [System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] void GetRestrictedPermissions(IInternalConfigRecord configRecord, out PermissionSet permissionSet, out bool isHostReady); -#pragma warning restore SYSLIB0003 // Obsolete: CAS } } diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/InternalConfigHost.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/InternalConfigHost.cs index 52a7360c506a5a..a70d38737cf33d 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/InternalConfigHost.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/InternalConfigHost.cs @@ -304,12 +304,11 @@ internal static bool StaticIsFile(string streamName) public IDisposable Impersonate() => new DummyDisposable(); -#pragma warning disable SYSLIB0003 + [System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public void GetRestrictedPermissions(IInternalConfigRecord configRecord, out PermissionSet permissionSet, out bool isHostReady) { permissionSet = new PermissionSet(null); isHostReady = true; } -#pragma warning restore SYSLIB0003 } } diff --git a/src/libraries/testPackages/packageSettings/System.Configuration.ConfigurationManager/netstandard/settings.targets b/src/libraries/testPackages/packageSettings/System.Configuration.ConfigurationManager/netstandard/settings.targets new file mode 100644 index 00000000000000..2b225059876410 --- /dev/null +++ b/src/libraries/testPackages/packageSettings/System.Configuration.ConfigurationManager/netstandard/settings.targets @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/libraries/testPackages/packageSettings/System.Runtime.Caching/netstandard/settings.targets b/src/libraries/testPackages/packageSettings/System.Runtime.Caching/netstandard/settings.targets new file mode 100644 index 00000000000000..9a2d7cd0482f45 --- /dev/null +++ b/src/libraries/testPackages/packageSettings/System.Runtime.Caching/netstandard/settings.targets @@ -0,0 +1,6 @@ + + + + + +