Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove S.S.Permissions reference from S.C.ConfigurationManager #82259

Merged
merged 8 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" />
steveharter marked this conversation as resolved.
Show resolved Hide resolved
</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" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting -- it looks like System.Runtime.Caching is the only library that retained it's control knob to from config file:

MemoryCacheSection section = ConfigurationManager.GetSection("system.runtime.caching/memoryCache") as MemoryCacheSection;

Probably because it was viewed as a "legacy" package with a replacement in Microsoft.Extensions -- similar to System.Configuration.ConfiguratinManager itself.

</ItemGroup>
</Project>