Skip to content

ConsoleHost.PushRunspace throws NullReferenceException when passed a local runspace #5735

Closed

Description

Steps to reproduce

$rs = [runspacefactory]::CreateRunspace()
$rs.Open()
$Host.PushRunspace($rs)

Expected behavior

Either throw a NotSupportedException that states only remote runspaces are supported, or (preferably) enter the local runspace successfully.

Actual behavior

> $rs = [runspacefactory]::CreateRunspace()
> $rs.Open()
> $Host.PushRunspace($rs)
Exception calling "PushRunspace" with "1" argument(s): "Object reference not set to an instance of an object."
At line:1 char:1
+ $Host.PushRunspace($rs)
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NullReferenceException

> $Error[0].Exception.InnerException | Format-List * -Force
Message        : Object reference not set to an instance of an object.
Data           : {}
InnerException :
TargetSite     : Void PushRunspace(System.Management.Automation.Runspaces.Runspace)
StackTrace     :    at Microsoft.PowerShell.ConsoleHost.PushRunspace(Runspace newRunspace)
                    at CallSite.Target(Closure , CallSite , Object , Object )
HelpLink       :
Source         : Microsoft.PowerShell.ConsoleHost
HResult        : -2147467261

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-rc.2
PSEdition                      Core
GitCommitId                    v6.0.0-rc.2
OS                             Microsoft Windows 10.0.15063
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. added
    WG-Enginecore PowerShell engine, interpreter, and runtime
    Issue-BugIssue has been identified as a bug in the product
    on Dec 22, 2017
  2. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  3. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  4. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  5. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions