Skip to content

PipeSecurity (netstandard2.0) does not use .NET Framework implementation when loaded in Windows PowerShell #27331

Closed
@rjmholt

Description

@rjmholt

Not sure if this is the right place to ask about this, but let me know if not.

I'm trying to port a codebase that used to compile against net451 and netstandard1.6 to netstandard2.0.

(The code is essentially a PowerShell module that has to work with both Windows PowerShell and PS Core.)

I'm hitting a crash where constructing a PipeSecurity object in PS Core (netcoreapp2.1) on Windows throws this error:

An error occurred while starting PowerShell Editor Services:

Exception calling "StartLanguageService" with "2" argument(s): "Access Control List (ACL) APIs are part of resource management on Windows and
are not supported on this platform."
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
   at System.Management.Automation.CommandProcessorBase.Complete()
Access Control List (ACL) APIs are part of resource management on Windows and are not supported on this platform.
   at System.Security.AccessControl.ObjectSecurity..ctor()
   at System.Security.AccessControl.CommonObjectSecurity..ctor(Boolean isContainer)
   at System.Security.AccessControl.NativeObjectSecurity..ctor(Boolean isContainer, ResourceType resourceType)
   at System.IO.Pipes.PipeSecurity..ctor()
   at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.Channel.NamedPipeServerListener.Start()
   at Microsoft.PowerShell.EditorServices.Host.EditorServicesHost.StartLanguageService(EditorServiceTransportConfig config, ProfilePaths profilePaths)
   at CallSite.Target(Closure , CallSite , Object , Object , Object )

That's occurring in our codebase here: https://github.com/PowerShell/PowerShellEditorServices/blob/f45c6312a859cde4aa25ea347a345e1d35238350/src/PowerShellEditorServices.Protocol/MessageProtocol/Channel/NamedPipeServerListener.cs#L38-L67

The PR I'm making the changes in is here: PowerShell/PowerShellEditorServices#741

The PipeSecurity constructor was working for us in netstandard1.6, although it looks like this is a netstandard specific error message: https://github.com/dotnet/corefx/blob/032cc324f9f3c6d6fee7ca01e7aa8e3a4969deb9/src/System.Security.AccessControl/src/System.Security.AccessControl.csproj#L6

Is there a way for me to construct the PipeSecurity object in a netstandard2.0 library running against netcoreapp2.1 on Windows?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions