Skip to content

Commit

Permalink
Remove S.S.Permissions reference from S.C.ConfigurationManager (#82259)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveharter authored Mar 8, 2023
1 parent e486f38 commit 9d6e592
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
<Nullable>disable</Nullable>
<NoWarn>$(NoWarn);CS0618</NoWarn>
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
</PropertyGroup>

<ItemGroup>
Expand All @@ -12,8 +13,9 @@
<Compile Include="System.Configuration.ConfigurationManager.netframework.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\ref\System.Security.Permissions.csproj" />
<!-- This reference is for the System.Security.PermissionSet class, which is implemented in corelib, so the reference is only necessary for netstandard. -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\ref\System.Security.Permissions.csproj" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!-- opt-out of trimming until it works https://github.com/dotnet/runtime/issues/49062 -->
<IsTrimmable>false</IsTrimmable>
<EnableAOTAnalyzer>false</EnableAOTAnalyzer>
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
<IsPackable>true</IsPackable>
<PackageDescription>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.</PackageDescription>
</PropertyGroup>
Expand Down Expand Up @@ -272,9 +273,9 @@
<Compile Include="System\Diagnostics\TraceUtils.cs" />
</ItemGroup>

<!-- Since this package is compatible with .NETStandard, it must also ensure its .NETFramework and .NETCoreApp behavior is compatible with its .NETStandard behavior.-->
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\src\System.Security.Permissions.csproj" />
<!-- This reference is for the System.Security.PermissionSet class, which is implemented in corelib, so the reference is only necessary for netstandard. -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\src\System.Security.Permissions.csproj" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<ItemGroup>
<!-- intentional dangling ref -->
<IgnoredReference Include="System.Security.Permissions" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<ItemGroup>
<!-- intentional dangling ref in System.Configuration.ConfigurationManager -->
<IgnoredReference Include="System.Security.Permissions" />
</ItemGroup>
</Project>

0 comments on commit 9d6e592

Please sign in to comment.