You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PSSessions with Containers throw NullReferenceException #13347
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.
Yes, there have been some cases where container images do not contain the correct Hyper-V binaries needed for a PowerShellDirect connection. The Hyper-V team who owns these binaries are aware of the issue. But this problem is outside of PowerShell.
I am not sure on this Paul Higinbotham (@PaulHigin). How is this outside of PowerShell? The same container can be accessed without problems through a New-PSSession from PowerShell 5.1. It does look like a PS6/7+ problem to me, no?
If WindowsPowerShell can connect to the same container
Sorry, you're right: I did not mention it in the original description. But PS 5.1 is definitely able to access the same identical container. PS 7.0.0 and PS 7.0.3 can not.
Following-up with Hyper-V team to see if they have changed their schema again as the code is trying to get Hyper-V properties, but ObRoot property is returning null.
Activity
iSazonov commentedon Aug 4, 2020
/cc Paul Higinbotham (@PaulHigin) Have you any thoughts about the issue?
PaulHigin commentedon Aug 4, 2020
Yes, there have been some cases where container images do not contain the correct Hyper-V binaries needed for a PowerShellDirect connection. The Hyper-V team who owns these binaries are aware of the issue. But this problem is outside of PowerShell.
hemisphera commentedon Aug 6, 2020
I am not sure on this Paul Higinbotham (@PaulHigin). How is this outside of PowerShell? The same container can be accessed without problems through a
New-PSSessionfrom PowerShell 5.1. It does look like a PS6/7+ problem to me, no?PaulHigin commentedon Aug 6, 2020
The original issue description did not mention this. If WindowsPowerShell can connect to the same container using the same command:
Then that would indicate a client error. But I am not aware of any changes to this code in either WindowsPowerShell or PowerShell core.
PaulHigin commentedon Aug 6, 2020
The only change I see in this code was made two years ago, to fix an incompatibility.
PR #7883
/cc Steve Lee (@SteveL-MSFT)
hemisphera commentedon Aug 6, 2020
Sorry, you're right: I did not mention it in the original description. But PS 5.1 is definitely able to access the same identical container. PS 7.0.0 and PS 7.0.3 can not.
PaulHigin commentedon Aug 6, 2020
Steve Lee (@SteveL-MSFT) Can you look at this and see if it is related to the fix you made for #7883?
1 remaining item
SteveL-MSFT commentedon Aug 6, 2020
Following-up with Hyper-V team to see if they have changed their schema again as the code is trying to get Hyper-V properties, but
ObRootproperty is returning null.SteveL-MSFT commentedon Aug 10, 2020
The official answer from Hyper-V team is that they also changed this to a field from a property.
PowerShell#13347: ObRoot: Use field if property does not exist
PowerShell#13347: refactoring + check field first
PowerShell#13347: throw 'PSInvalidOperationException' instead of 'Arg…
PowerShell#13347: Added comment about Hyper-V change + variable name fix