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.DirectoryServices #82453

Merged
merged 15 commits into from
Mar 16, 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 @@ -262,54 +262,6 @@ 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() { }
public DirectoryServicesPermission(System.DirectoryServices.DirectoryServicesPermissionAccess permissionAccess, string? path) { }
public DirectoryServicesPermission(System.DirectoryServices.DirectoryServicesPermissionEntry[]? permissionAccessEntries) { }
public DirectoryServicesPermission(System.Security.Permissions.PermissionState state) { }
public System.DirectoryServices.DirectoryServicesPermissionEntryCollection? PermissionEntries { get { throw null; } }
}
[System.FlagsAttribute]
public enum DirectoryServicesPermissionAccess
{
None = 0,
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
{
public DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction action) : base(default(System.Security.Permissions.SecurityAction)) { }
public string? Path { get { throw null; } set { } }
public System.DirectoryServices.DirectoryServicesPermissionAccess PermissionAccess { get { throw null; } set { } }
public override System.Security.IPermission? CreatePermission() { throw null; }
}
public partial class DirectoryServicesPermissionEntry
{
public DirectoryServicesPermissionEntry(System.DirectoryServices.DirectoryServicesPermissionAccess permissionAccess, string? path) { }
public string? Path { get { throw null; } }
public System.DirectoryServices.DirectoryServicesPermissionAccess PermissionAccess { get { throw null; } }
}
public partial class DirectoryServicesPermissionEntryCollection : System.Collections.CollectionBase
{
internal DirectoryServicesPermissionEntryCollection() { }
public System.DirectoryServices.DirectoryServicesPermissionEntry? this[int index] { get { throw null; } set { } }
public int Add(System.DirectoryServices.DirectoryServicesPermissionEntry value) { throw null; }
public void AddRange(System.DirectoryServices.DirectoryServicesPermissionEntryCollection value) { }
public void AddRange(System.DirectoryServices.DirectoryServicesPermissionEntry[] value) { }
public bool Contains(System.DirectoryServices.DirectoryServicesPermissionEntry value) { throw null; }
public void CopyTo(System.DirectoryServices.DirectoryServicesPermissionEntry[] array, int index) { }
public int IndexOf(System.DirectoryServices.DirectoryServicesPermissionEntry value) { throw null; }
public void Insert(int index, System.DirectoryServices.DirectoryServicesPermissionEntry value) { }
protected override void OnClear() { }
protected override void OnInsert(int index, object? value) { }
protected override void OnRemove(int index, object? value) { }
protected override void OnSet(int index, object? oldValue, object? newValue) { }
public void Remove(System.DirectoryServices.DirectoryServicesPermissionEntry? value) { }
}
public partial class DirectorySynchronization
{
public DirectorySynchronization() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\ref\System.Security.Permissions.csproj" />
<!-- Use of 'PrivateAssets=all' removes the package reference to S.S.P since S.S.P has references to other packages that are not desired.
S.S.P only contains DirectoryServices obsolete types including DirectoryServicesPermission.-->
<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="'$(TargetFramework)' == 'netstandard2.0'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
// ------------------------------------------------------------------------------

using System.DirectoryServices.Design;
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermission))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionAccess))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionAttribute))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionEntry))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionEntryCollection))]

namespace System.DirectoryServices
{
Expand All @@ -15,4 +22,4 @@ public partial class DirectoryEntry { }
namespace System.DirectoryServices.Design
{
internal sealed class DirectoryEntryConverter { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
Copy link
Member

Choose a reason for hiding this comment

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

These errors are all saying that you are missing the type-forwards from the implementation assembly.

Copy link
Member Author

Choose a reason for hiding this comment

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

The forwards were added; the "baseline" suppressions are still necessary.

Copy link
Member

Choose a reason for hiding this comment

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

They should not be necessary. API Compat should not raise the error if the type is forwarded - it should see that forward and compare the forwarded definition.

Copy link
Member

Choose a reason for hiding this comment

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

@ViktorHofer looks like something is going wrong with APICompat following type forwards. I pulled this branch and reproduced it. I can inspect the assemblies and I see that the new S.DS has a type forward for these types in S.S.P and the types exist there.

@steveharter please file an issue for this and merge with the suppression.

Copy link
Member Author

Choose a reason for hiding this comment

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

<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.DirectoryServices.DirectoryServicesPermission</Target>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.DirectoryServices.DirectoryServicesPermissionAccess</Target>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.DirectoryServices.DirectoryServicesPermissionAttribute</Target>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.DirectoryServices.DirectoryServicesPermissionEntry</Target>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.DirectoryServices.DirectoryServicesPermissionEntryCollection</Target>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermission))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionAccess))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionAttribute))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionEntry))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionEntryCollection))]
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ System.DirectoryServices.ActiveDirectory.DomainController</PackageDescription>
</PropertyGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
<Compile Include="System.DirectoryServices.Forwards.cs" />
<Compile Include="System\DirectoryServices\ActiveDirectorySecurity.cs" />
<Compile Include="System\DirectoryServices\AdsVLV.cs" />
<Compile Include="System\DirectoryServices\AuthenticationTypes.cs" />
Expand Down Expand Up @@ -136,11 +137,6 @@ System.DirectoryServices.ActiveDirectory.DomainController</PackageDescription>
<Compile Include="System\DirectoryServices\ActiveDirectory\UnsafeNativeMethods.cs" />
<Compile Include="System\DirectoryServices\ActiveDirectory\Utils.cs" />
<Compile Include="System\DirectoryServices\ActiveDirectory\WellKnownDN.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermission.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermissionAccess.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermissionAttribute.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermissionEntry.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermissionEntryCollection.cs" />
<Compile Include="Interop\AdsOptions.cs" />
<Compile Include="Interop\AdsPropertyOperation.cs" />
<Compile Include="Interop\AdsSearchColumn.cs" />
Expand Down Expand Up @@ -241,7 +237,9 @@ System.DirectoryServices.ActiveDirectory.DomainController</PackageDescription>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\src\System.Security.Permissions.csproj" />
<!-- Use of 'PrivateAssets=all' removes the package reference to S.S.P since S.S.P has references to other packages that are not desired.
S.S.P only contains DirectoryServices obsolete types including DirectoryServicesPermission.-->
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\src\System.Security.Permissions.csproj" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- SYSLIB0003: CAS is obsolete, but we still have tests referencing it -->
<NoWarn>$(NoWarn);SYSLIB0003</NoWarn>
Expand Down Expand Up @@ -32,6 +32,7 @@
<Compile Include="System\DirectoryServices\DirectoryServicesTests.Windows.cs" />
<Compile Include="System\DirectoryServices\ActiveDirectoryComInterop.cs" />
<ProjectReference Include="..\src\System.DirectoryServices.csproj" />
<ProjectReference Include="..\..\System.Security.Permissions\src\System.Security.Permissions.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.DirectoryServices" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<ProjectReference Include="$(LibrariesProjectRoot)System.DirectoryServices.Protocols\src\System.DirectoryServices.Protocols.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.DirectoryServices\src\System.DirectoryServices.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.Packaging\src\System.IO.Packaging.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\src\System.Security.Permissions.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Reflection.Metadata\src\System.Reflection.Metadata.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,57 @@ protected override void OnSet(int index, object oldValue, object newValue) { }
public void Remove(System.Diagnostics.PerformanceCounterPermissionEntry value) { }
}
}
namespace System.DirectoryServices
{
[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() { }
public DirectoryServicesPermission(System.DirectoryServices.DirectoryServicesPermissionAccess permissionAccess, string path) { }
public DirectoryServicesPermission(System.DirectoryServices.DirectoryServicesPermissionEntry[] permissionAccessEntries) { }
public DirectoryServicesPermission(System.Security.Permissions.PermissionState state) { }
public System.DirectoryServices.DirectoryServicesPermissionEntryCollection PermissionEntries { get { throw null; } }
}
[System.FlagsAttribute]
public enum DirectoryServicesPermissionAccess
{
None = 0,
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
{
public DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction action) : base(default(System.Security.Permissions.SecurityAction)) { }
public string Path { get { throw null; } set { } }
public System.DirectoryServices.DirectoryServicesPermissionAccess PermissionAccess { get { throw null; } set { } }
public override System.Security.IPermission CreatePermission() { throw null; }
}
public partial class DirectoryServicesPermissionEntry
{
public DirectoryServicesPermissionEntry(System.DirectoryServices.DirectoryServicesPermissionAccess permissionAccess, string path) { }
public string Path { get { throw null; } }
public System.DirectoryServices.DirectoryServicesPermissionAccess PermissionAccess { get { throw null; } }
}
public partial class DirectoryServicesPermissionEntryCollection : System.Collections.CollectionBase
{
internal DirectoryServicesPermissionEntryCollection() { }
public System.DirectoryServices.DirectoryServicesPermissionEntry this[int index] { get { throw null; } set { } }
public int Add(System.DirectoryServices.DirectoryServicesPermissionEntry value) { throw null; }
public void AddRange(System.DirectoryServices.DirectoryServicesPermissionEntryCollection value) { }
public void AddRange(System.DirectoryServices.DirectoryServicesPermissionEntry[] value) { }
public bool Contains(System.DirectoryServices.DirectoryServicesPermissionEntry value) { throw null; }
public void CopyTo(System.DirectoryServices.DirectoryServicesPermissionEntry[] array, int index) { }
public int IndexOf(System.DirectoryServices.DirectoryServicesPermissionEntry value) { throw null; }
public void Insert(int index, System.DirectoryServices.DirectoryServicesPermissionEntry value) { }
protected override void OnClear() { }
protected override void OnInsert(int index, object value) { }
protected override void OnRemove(int index, object value) { }
protected override void OnSet(int index, object oldValue, object newValue) { }
public void Remove(System.DirectoryServices.DirectoryServicesPermissionEntry value) { }
}
}
namespace System.Drawing.Printing
{
#if NETCOREAPP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
<Nullable>disable</Nullable>
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
</PropertyGroup>

<ItemGroup>
Expand All @@ -25,6 +26,7 @@
<Reference Include="System.Net" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermission))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionAccess))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionAttribute))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionEntry))]
[assembly: TypeForwardedTo(typeof(System.DirectoryServices.DirectoryServicesPermissionEntryCollection))]
[assembly: TypeForwardedTo(typeof(System.Security.IPermission))]
[assembly: TypeForwardedTo(typeof(System.Security.ISecurityEncodable))]
[assembly: TypeForwardedTo(typeof(System.Security.Permissions.CodeAccessSecurityAttribute))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<NoWarn>$(NoWarn);nullable</NoWarn>
<IsPackable>true</IsPackable>
<PackageDescription>Provides types supporting Code Access Security (CAS).</PackageDescription>
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
Expand All @@ -32,6 +33,11 @@
<Compile Include="System\Diagnostics\PerformanceCounterPermissionAttribute.cs" />
<Compile Include="System\Diagnostics\PerformanceCounterPermissionEntry.cs" />
<Compile Include="System\Diagnostics\PerformanceCounterPermissionEntryCollection.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermission.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermissionAccess.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermissionAttribute.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermissionEntry.cs" />
<Compile Include="System\DirectoryServices\DirectoryServicesPermissionEntryCollection.cs" />
<Compile Include="System\Drawing\Printing\PrintingPermission.cs" />
<Compile Include="System\Drawing\Printing\PrintingPermissionAttribute.cs" />
<Compile Include="System\Drawing\Printing\PrintingPermissionLevel.cs" />
Expand Down Expand Up @@ -206,6 +212,7 @@
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.Configuration" />
<Reference Include="System.Data.OracleClient" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Net" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceProcess" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<Compile Include="XamlLoadPermissionTests.cs"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\System.Security.Permissions.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.DirectoryServices\src\System.DirectoryServices.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<ItemGroup>
<!-- intentional dangling ref from System.DirectoryServices -->
<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 -->
<IgnoredReference Include="System.Security.Permissions" />
</ItemGroup>
</Project>