Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Omissions in types supported by both Desktop and Core - System.Security.AccessControl.AuthorizationRuleCollection #17604

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<Compile Include="System\IO\FileSystemAclExtensions.net46.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)'!='netfx'">
<Reference Include="System.Collections.NonGeneric" />
<Reference Include="System.Diagnostics.Contracts" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.IO.FileSystem" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected internal AuthorizationRule(System.Security.Principal.IdentityReference
public bool IsInherited { get { throw null; } }
public System.Security.AccessControl.PropagationFlags PropagationFlags { get { throw null; } }
}
public sealed partial class AuthorizationRuleCollection
public sealed partial class AuthorizationRuleCollection : System.Collections.ReadOnlyCollectionBase
{
public AuthorizationRuleCollection() { }
public System.Security.AccessControl.AuthorizationRule this[int index] { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System.Security.AccessControl.cs" />
<Compile Include="System.Security.AccessControl.Manual.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Security.Principal.Windows\ref\System.Security.Principal.Windows.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
</ItemGroup>
<ItemGroup>
<Reference Include="System.Collections" />
<Reference Include="System.Collections.NonGeneric" />
Copy link
Member

Choose a reason for hiding this comment

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

Before we merge this -- @joperezr @weshaggard

S.S.AccessControl builds for netstandard but S.C.NonGeneric builds for netcoreapp and uap specifically. So assume this reference is prohibited. But why does NonGenreic not build for netstandard only?

Copy link
Member

@danmoseley danmoseley Mar 28, 2017

Choose a reason for hiding this comment

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

Oh, it's because it depends on System.Runtime and S.R.Extensions and S.Globalization and those don't have netstandard configurations. Can we unravel this somehow?

If I change S.C.NG to netstandard I get C:\git\corefx\buildvertical.targets(153,5): error : Could not find a configuration for ProjectReference '..\..\System.Runtime\ref\System.Runtime.csproj' from configurations 'netcoreapp;uap' when building 'System.Collections.NonGeneric' for configuration 'netstandard-Debug' . [C:\git\corefx\src\System.Collections.NonG eneric\ref\System.Collections.NonGeneric.csproj]

Copy link
Member

Choose a reason for hiding this comment

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

I'm missing something conceptually -- I guess types in netstandard can be defined in libraries that don't have a netstandard configuration. That makes sense I guess. So is this new reference legal?

Copy link
Member

Choose a reason for hiding this comment

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

S.S.AccessControl doesn't build for netstandard, at least not the implementation. The implementation is also platform-specific (uap, netcoreapp) which is why this is a valid reference.

Copy link
Member

Choose a reason for hiding this comment

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

That's what confused me -- the ref is built for netstandard. Why's that? Do we just do that for convenience whenever it happens to compile successfully for netstandard?

Copy link
Member

Choose a reason for hiding this comment

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

We should actually consider switching this library to be netstandard but if we do that then we may need to set some explicit configurations to Generate platform not supported exceptions (i.e. unix and maybe uap).

Copy link
Member Author

Choose a reason for hiding this comment

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

should we merge the PR for now and track these ideas in a separate issue?

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with merging this once CI is green. We do need to file an issue about all the AccessControl APIs about whether or not we want to support then for netstandard or not. @joperezr was going to file a similar issue, so chat with him about it.

Copy link
Member

Choose a reason for hiding this comment

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

I logged: #17660

<Reference Include="System.Diagnostics.Contracts" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Resources.ResourceManager" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,56 +347,8 @@ public ObjectAceFlags ObjectFlags
}


public sealed class AuthorizationRuleCollection : ICollection, IEnumerable // TODO: Is this right? Was previously ReadOnlyCollectionBase
public sealed class AuthorizationRuleCollection : ReadOnlyCollectionBase
{
#region ReadOnlyCollectionBase APIs
// Goo to translate this from ReadOnlyCollectionBase to ICollection
Object _syncRoot;
List<AuthorizationRule> list;

List<AuthorizationRule> InnerList
{
get
{
if (list == null)
list = new List<AuthorizationRule>();
return list;
}
}

public int Count
{
get { return InnerList.Count; }
}

bool ICollection.IsSynchronized
{
get { return false; }
}

object ICollection.SyncRoot
{
get
{
if (_syncRoot == null)
{
System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
}
return _syncRoot;
}
}

void ICollection.CopyTo(Array array, int index)
{
InnerList.CopyTo((AuthorizationRule[])array, index);
}

IEnumerator IEnumerable.GetEnumerator()
{
return InnerList.GetEnumerator();
}
#endregion

#region Constructors

public AuthorizationRuleCollection()
Expand Down
12 changes: 7 additions & 5 deletions src/shims/ApiCompatBaseline.netcoreapp.netfx461.txt
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ TypesMustExist : Type 'System.Reflection.Emit.DynamicILInfo' does not exist in t
CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.DynamicMethod' does not implement interface 'System.Runtime.InteropServices._MethodInfo' in the implementation but it does in the contract.
MembersMustExist : Member 'System.Reflection.Emit.DynamicMethod.DefineParameter(System.Int32, System.Reflection.ParameterAttributes, System.String)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.DynamicMethod.GetDynamicILInfo()' does not exist in the implementation but it does exist in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.EnumBuilder' does not implement interface 'System.Runtime.InteropServices._EnumBuilder' in the implementation but it does in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.EnumBuilder' does not inherit from base type 'System.Reflection.TypeInfo' in the implementation but it does in the contract.
MembersMustExist : Member 'System.Reflection.Emit.EnumBuilder.CreateType()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.EnumBuilder.IsAssignableFrom(System.Reflection.TypeInfo)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.EnumBuilder.TypeToken.get()' does not exist in the implementation but it does exist in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.EventBuilder' does not implement interface 'System.Runtime.InteropServices._EventBuilder' in the implementation but it does in the contract.
MembersMustExist : Member 'System.Reflection.Emit.EventBuilder.GetEventToken()' does not exist in the implementation but it does exist in the contract.
Expand All @@ -329,7 +330,8 @@ CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.FieldBuilder' doe
MembersMustExist : Member 'System.Reflection.Emit.FieldBuilder.GetToken()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.FieldBuilder.SetMarshal(System.Reflection.Emit.UnmanagedMarshal)' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Reflection.Emit.FieldToken' does not exist in the implementation but it does exist in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.GenericTypeParameterBuilder' does not implement interface 'System.Runtime.InteropServices._Type' in the implementation but it does in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.GenericTypeParameterBuilder' does not inherit from base type 'System.Reflection.TypeInfo' in the implementation but it does in the contract.
MembersMustExist : Member 'System.Reflection.Emit.GenericTypeParameterBuilder.IsAssignableFrom(System.Reflection.TypeInfo)' does not exist in the implementation but it does exist in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.ILGenerator' does not implement interface 'System.Runtime.InteropServices._ILGenerator' in the implementation but it does in the contract.
MembersMustExist : Member 'System.Reflection.Emit.ILGenerator.EmitCalli(System.Reflection.Emit.OpCode, System.Runtime.InteropServices.CallingConvention, System.Type, System.Type[])' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.ILGenerator.MarkSequencePoint(System.Diagnostics.SymbolStore.ISymbolDocumentWriter, System.Int32, System.Int32, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract.
Expand Down Expand Up @@ -385,11 +387,12 @@ MembersMustExist : Member 'System.Reflection.Emit.SignatureHelper.GetMethodSigHe
MembersMustExist : Member 'System.Reflection.Emit.SignatureHelper.GetMethodSigHelper(System.Runtime.InteropServices.CallingConvention, System.Type)' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Reflection.Emit.SignatureToken' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Reflection.Emit.StringToken' does not exist in the implementation but it does exist in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.TypeBuilder' does not implement interface 'System.Runtime.InteropServices._TypeBuilder' in the implementation but it does in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Reflection.Emit.TypeBuilder' does not inherit from base type 'System.Reflection.TypeInfo' in the implementation but it does in the contract.
MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.AddDeclarativeSecurity(System.Security.Permissions.SecurityAction, System.Security.PermissionSet)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.DefinePInvokeMethod(System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.DefinePInvokeMethod(System.String, System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.DefinePInvokeMethod(System.String, System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Type[], System.Type[], System.Type[][], System.Type[][], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.IsAssignableFrom(System.Reflection.TypeInfo)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Reflection.Emit.TypeBuilder.TypeToken.get()' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Reflection.Emit.TypeToken' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Reflection.Emit.UnmanagedMarshal' does not exist in the implementation but it does exist in the contract.
Expand Down Expand Up @@ -816,7 +819,6 @@ CannotRemoveBaseTypeOrInterface : Type 'System.Security.SuppressUnmanagedCodeSec
CannotRemoveBaseTypeOrInterface : Type 'System.Security.UnverifiableCodeAttribute' does not implement interface 'System.Runtime.InteropServices._Attribute' in the implementation but it does in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Security.VerificationException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Security.XmlSyntaxException' does not implement interface 'System.Runtime.InteropServices._Exception' in the implementation but it does in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Security.AccessControl.AuthorizationRuleCollection' does not inherit from base type 'System.Collections.ReadOnlyCollectionBase' in the implementation but it does in the contract.
TypesMustExist : Type 'System.Security.AccessControl.CryptoKeyAccessRule' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Security.AccessControl.CryptoKeyAuditRule' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Security.AccessControl.CryptoKeyRights' does not exist in the implementation but it does exist in the contract.
Expand Down Expand Up @@ -3230,4 +3232,4 @@ CannotRemoveBaseTypeOrInterface : Type 'System.Xml.Xsl.XsltException' does not i
MembersMustExist : Member 'System.Xml.Xsl.XslTransform.Load(System.Xml.XmlReader, System.Xml.XmlResolver, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Xml.Xsl.XslTransform.Load(System.Xml.XPath.IXPathNavigable, System.Xml.XmlResolver, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Xml.Xsl.XslTransform.Load(System.Xml.XPath.XPathNavigator, System.Xml.XmlResolver, System.Security.Policy.Evidence)' does not exist in the implementation but it does exist in the contract.
Total Issues: 3217
Total Issues: 3219