-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
This code is not working, can't create sunspace with RunspaceFactory.CreateRunspace(sshConnectionInfo).
this bug already was described and discussed in #15641 but without any fix
using System;
using System.Management.Automation;
using System.Management.Automation.Remoting;
using System.Management.Automation.Runspaces;
namespace util
{
class Program
{
static void Main(string[] args)
{
var connectionInfo = new SSHConnectionInfo("username", "machinename", null, port: 22)
{
};
var runspace = RunspaceFactory.CreateRunspace(connectionInfo);
runspace.Open();
System.Console.WriteLine("Hit any key to exit...");
System.Console.ReadKey();
}
}
}
Expected behavior
new sunspace createdActual behavior
ExceptionError details
System.Management.Automation.Remoting.PSRemotingDataStructureException: An error has occurred which PowerShell cannot handle. A remote session might have ended.
---> System.ComponentModel.Win32Exception (2): No such file or directory
at System.Management.Automation.Runspaces.SSHConnectionInfo.CreateProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Int32 creationFlags, Int32& lpChildPid, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd)
at System.Management.Automation.Runspaces.SSHConnectionInfo.StartSSHProcess(ProcessStartInfo startInfo, StreamWriter& standardInput, StreamReader& standardOutput, StreamReader& standardError)
at System.Management.Automation.Runspaces.SSHConnectionInfo.StartSSHProcessImpl(ProcessStartInfo startInfo, StreamWriter& stdInWriterVar, StreamReader& stdOutReaderVar, StreamReader& stdErrReaderVar)
at System.Management.Automation.Runspaces.SSHConnectionInfo.StartSSHProcess(StreamWriter& stdInWriterVar, StreamReader& stdOutReaderVar, StreamReader& stdErrReaderVar)
at System.Management.Automation.Remoting.Client.SSHClientSessionTransportManager.CreateAsync()
at System.Management.Automation.Remoting.ClientRemoteSessionDSHandlerImpl.SendNegotiationAsync(RemoteSessionState sessionState)
at System.Management.Automation.Remoting.ClientRemoteSessionDSHandlerImpl.HandleStateChanged(Object sender, RemoteSessionStateEventArgs arg)
at System.Management.Automation.ExtensionMethods.SafeInvoke[T](EventHandler`1 eventHandler, Object sender, T eventArgs)
at System.Management.Automation.Remoting.ClientRemoteSessionDSHandlerStateMachine.RaiseStateMachineEvents()
at System.Management.Automation.Remoting.ClientRemoteSessionDSHandlerStateMachine.ProcessEvents()
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
at System.Management.Automation.Runspaces.Internal.RunspacePoolInternal.EndOpen(IAsyncResult asyncResult)
at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal.Open()
at System.Management.Automation.Runspaces.RunspacePool.Open()
at System.Management.Automation.RemoteRunspace.Open()
at Program.<Main>$(String[] args) in /Users/onovikov/RiderProjects/helloworld/helloworld/Program.cs:line 25Environment data
❯ $PSVersionTable
Name Value
---- -----
PSVersion 7.5.2
PSEdition Core
GitCommitId 7.5.2
OS Darwin 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:52:00 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6031
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Metadata
Metadata
Assignees
Labels
No labels