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

Conversation

steveharter
Copy link
Member

@steveharter steveharter commented Feb 16, 2023

Contributes to #64592

This PR, if approved, will replace #80347 since it is less risky by not requiring removing public members. This is possible since it turns out S.S.P does not contain the implementation of the PermissionSet class (it's in corelib).

The use of PrivateAssets="all" allows the reference to the S.S.P package to be removed from the netstandard version of the S.C.CM package.

This will still be considered a breaking change, but only because a package reference was removed.

The System.Configuration.ConfigurationManager .nuspec goes from:

    <dependencies>
      <group targetFramework=".NETFramework4.6.2">
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net6.0">
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net7.0">
        <dependency id="System.Diagnostics.EventLog" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net8.0">
        <dependency id="System.Diagnostics.EventLog" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETStandard2.0">
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
    </dependencies>

to:

    <dependencies>
      <group targetFramework=".NETFramework4.6.2" />
      <group targetFramework="net6.0">
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net7.0">
        <dependency id="System.Diagnostics.EventLog" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net8.0">
        <dependency id="System.Diagnostics.EventLog" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETStandard2.0">
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
    </dependencies>

@ghost
Copy link

ghost commented Feb 16, 2023

Tagging subscribers to this area: @dotnet/area-system-configuration
See info in area-owners.md if you want to be subscribed.

Issue Details

Contributes to #64592

This PR, if approved, will replace #80347 since it is less risky by not requiring removing public members. This is possible since it turns out S.S.P does not contain the implementation of the PermissionSet class (it's in corelib).

The use of PrivateAssets="all" allows the reference to the S.S.P package to be removed from the netstandard version of the package.

This will still be considered a breaking change, but only because a package reference was removed.

The System.Configuration.ConfigurationManager .nuspec goes from:

    <dependencies>
      <group targetFramework=".NETFramework4.6.2">
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net6.0">
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net7.0">
        <dependency id="System.Diagnostics.EventLog" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net8.0">
        <dependency id="System.Diagnostics.EventLog" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETStandard2.0">
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Permissions" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
    </dependencies>

to:

    <dependencies>
      <group targetFramework=".NETFramework4.6.2" />
      <group targetFramework="net6.0">
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net7.0">
        <dependency id="System.Diagnostics.EventLog" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="net8.0">
        <dependency id="System.Diagnostics.EventLog" version="8.0.0-dev" exclude="Build,Analyzers" />
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETStandard2.0">
        <dependency id="System.Security.Cryptography.ProtectedData" version="8.0.0-dev" exclude="Build,Analyzers" />
      </group>
    </dependencies>
Author: steveharter
Assignees: steveharter
Labels:

area-System.Configuration

Milestone: -

@steveharter steveharter requested a review from ericstj February 16, 2023 20:22
@steveharter steveharter added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Feb 16, 2023
@ghost ghost added the needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet label Feb 16, 2023
@ghost
Copy link

ghost commented Feb 16, 2023

Added needs-breaking-change-doc-created label because this PR has the breaking-change label.

When you commit this breaking change:

  1. Create and link to this PR and the issue a matching issue in the dotnet/docs repo using the breaking change documentation template, then remove this needs-breaking-change-doc-created label.
  2. Ask a committer to mail the .NET Breaking Change Notification DL.

Tagging @dotnet/compat for awareness of the breaking change.

@steveharter
Copy link
Member Author

@ViktorHofer there's a package test failure like this:

artifacts\bin\testPackages\packageTest.targets(50,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) Assembly 'System.Configuration.ConfigurationManager' is missing dependency 'System.Security.Permissions'

coming from Arcade's Microsoft.DotNet.PackageTesting I believe.

Do you know if there a suppression mechanism for that?

@ViktorHofer
Copy link
Member

ViktorHofer commented Feb 17, 2023

Do you know if there a suppression mechanism for that?

That usually indicates that package is incorrectly authored. @ericstj can you please take a look? I lack knowledge of what this PR tries to achieve and I currently don't have cycles to investigate further.

@steveharter
Copy link
Member Author

That usually indicates that package is incorrectly authored. @ericstj can you please take a look? I lack knowledge of what this PR tries to achieve and I currently don't have cycles to investigate further.

I added another commit that should address this.

@ViktorHofer
Copy link
Member

As Eric is out, please hold off merging until he is back and took a look. Just want to make sure that we understand all the implications of the change.

@steveharter
Copy link
Member Author

steveharter commented Feb 17, 2023

This approach does leave a dangling reference to [System.Security.Permissions]System.Security.PermissionSet in the netstandard build of S.C.CM:

instance void  GetRestrictedPermissions(class System.Configuration.Internal.IInternalConfigRecord configRecord,
                                        [out] class [System.Security.Permissions]System.Security.PermissionSet& permissionSet,
                                        [out] bool& isHostReady) cil managed

This is because the netstandard build of S.S.P cross-compiles PermissionSet and friends since they are not part of netstandard.

As mentioned earlier, the Net8.0 and Net462 builds of S.C.CM have a runtime reference instead since those types are implemented in corelib: [System.Runtime]System.Security.PermissionSet with no dependency on S.S.P (before or after this PR).

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

LGTM

<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.

@steveharter steveharter merged commit 9d6e592 into dotnet:main Mar 8, 2023
@steveharter steveharter deleted the CmPermissionSet branch March 8, 2023 14:02
@ghost ghost locked as resolved and limited conversation to collaborators Apr 7, 2023
@steveharter
Copy link
Member Author

Breaking change issue: dotnet/docs#36720

@steveharter steveharter removed the needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet label Oct 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Configuration breaking-change Issue or PR that represents a breaking API or functional change over a prerelease.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants