Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PSSessions with Containers throw NullReferenceException #13347

Copy link
Copy link
@hemisphera

Description

@hemisphera
Issue body actions

Cmdlets that deal with PSSessions created on ContainerId throw a NullReferenceException when creating the session. This is true for New-PSSession, Enter-PSSession and Invoke-Command, among maybe others.

The stack trace is this:

Object reference not set to an instance of an object.
   at System.Management.Automation.Runspaces.ContainerProcess.GetContainerProperties()
   at Microsoft.PowerShell.Commands.PSExecutionCmdlet.CreateHelpersForSpecifiedContainerSession()

For me the line that fails is inside GetContainerPropertiesInternal of the class System.Management.Automation.Runspaces.ContainerProcess in System.Management.Automation.dll.

ContainerObRoot = (string) computeSystemPropertiesType.GetProperty("ObRoot").GetValue(obj);

Steps to reproduce

To reproduce this a running container is required.

New-PSSession -ContainerId <TheContainerId> -RunAsAdministrator

Expected behavior

An instance of PSSession should be created.

Actual behavior

A NullReferenceException is thrown.

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productMustHaveResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.