PowerShell / PowerShell/PowerShell

CreateOutOfProcessRunspace fails to Open

Open
#23,886 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs-Triage
Dominant language
C#
Stars
55.5k
Forks
8.5k
Avg merge
1d 2h
Merged PRs (30d)
88

Description

Prerequisites
Steps to reproduce

I am trying to run the following script

function Get-PowerShellVersion {
$PSVersionTable.PSVersion
}

$psVersion = Get-PowerShellVersion
$typeTable = [System.Management.Automation.Runspaces.TypeTable]::new([string[]]@())
$powershellInstance = [System.Management.Automation.Runspaces.PowerShellProcessInstance]::new($psVersion, $null, $null, $true)
$runspace = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateOutOfProcessRunspace($typeTable, $powershellInstance)
$runspace.Open()

Expected behavior
$runspace.Open() should succeed.
Actual behavior
Fails with Error 

System.Management.Automation.Remoting.PSRemotingTransportException: The background process reported an error with the following message: W i n d o w s   P o w e r S h e l l   t e r m i n a t e d   w i t h   t h e   f o l l o w i n g   e r r o r :   .
   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()
Error details

No response

Environment data
Name                           Value
----                           -----
PSVersion                      5.1.17763.5820
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.5820
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the PowerShell script through CreateOutOfProcessRunspace and Runspace.Open() using the reported Windows PowerShell environment. Trace the background process failure and compare the reported PowerShellProcessInstance version and remoting setup; done means the runspace opens successfully without the PSRemotingTransportException.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.