Repository navigation
New-PSSession still fails with a NullReferenceException on macOS #4029
Description
Activity
- addedWG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer
on Jun 16, 2017 #3476 may also be related, same issue on CentOS, and another reporter on macOS.
I'm not sure what's meant when asked for a "simpler repro," but I was able to reproduce my issue again in a VM running 10.12.6 and the beta 4 release of PowerShell.
I've got this issue on macOS 10.12.6 and 10.13 with 6.0.0-rc
This is installing PowerShell via the macOS Installer Package. Apparently you can install it via Homebrew as well however the way that Homebrew opens up the permissions on some of the system binary directories (like /usr/local/bin) to make it group read/write is a security risk so I can't use it to test.
PowerShell v6.0.0-rc Copyright (c) Microsoft Corporation. All rights reserved. https://aka.ms/pscore6-docs Type 'help' to get help. PS /Users/kai> $PSVersionTable Name Value ---- ----- PSVersion 6.0.0-rc PSEdition Core GitCommitId v6.0.0-rc OS Darwin 16.7.0 Darwin Kernel Version 16.7.0: T... Platform Unix PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 PS /Users/kai> $UserCredential = Get-Credential PowerShell credential request Enter your credentials. User: [email protected] Password for user [email protected]: ******** PS /Users/kai> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid -Credential $UserCredential -Authentication Basic -AllowRedirection An error has occurred that was not properly handled. Additional information is shown below. The PowerShell process will exit. Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at System.Management.Automation.Remoting.PrioritySendDataCollection.Clear() at System.Management.Automation.Remoting.Client.BaseClientTransportManager.CloseAsync() at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.CloseAsync() at System.Management.Automation.Remoting.Client.BaseClientTransportManager.Finalize() Abort trap: 6- addedIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the product
on Nov 23, 2017 Steve Lee (@SteveL-MSFT) Related Issue #3476 was labeled as GA. Should we fix current Issue before GA too?
Dan Travison (@dantraMSFT) can you confirm with latest psl-omi-provider this works on macOS?
dantraMSFT commented
on Nov 28, 2017 ContributorMore actionsKai Howells (@kai-h) Are you able to consistently repro the NullReferenceException? I'm not able to repro it.
I can consistently reproduce this on two separate Macs. One with macOS 10.12 and one with 10.13.
It happens every single time - as in I have never been able to establish a New-PSSession on either of the two Macs I use.
I don't have a Linux workstation to test with the latest psl-omi-provider - I only have Ubuntu on Windows 10 available without creating a new VM for testing purposes.My environment is a pretty standard macOS installation with 10.12 or 10.13 and PowerShell 6.0.0-rc installed via the macOS Installer Package (.pkg) from the GitHub Releases page.
I haven't built it from source or installed via Homebrew.
Searching for more info on this error, in one thread (that I now can't find) someone reported that it was failing for them when they installed from the .pkg but when they installed from Homebrew it worked.dantraMSFT commented
on Nov 28, 2017 ContributorMore actionsThanks, Kai Howells (@kai-h), let me checkout out the pkg page.
dantraMSFT commented
on Nov 28, 2017 ContributorMore actionsKai Howells (@kai-h), unfortunately, I'm still not able to repro it. Would you change the file size and date stamps of libmi.dylib and libpsrpclient.dylib?
cd $pshome
ls -l lib*36 remaining items
Kai Howells (@kai-h): There's a bug in workaround I gave you. I'll give you another drop shortly to see if it resolves the problem of if there's something else going on.
Mark Kraus (@markekraus) - That command works in that when I give it my Office 365 credentials it displays lots of information about my user account and mailbox (I won't copy and paste it here) however it never returns to the command prompt. Even Ctrl+C doesn't kill it, the only solution appears to be to close the Terminal window.
Mark Kraus (@markekraus) - re symlinking to /usr/local/opt/openssl/lib
MacPorts installs the OpenSSL libraries in /opt/local/lib - I could try symlinking this to /usr/local/opt/openssl/lib for testing purposes, however there are likely to be other libraries in here other than the OpenSSL libraries if the end user has installed more packages with MacPorts.Kai Howells (@kai-h): The updated binary and pdb file is on dropbox.
Thank you for the new binaries. I have installed them and now I don't get an error when I invoke New-PSSession and the following command runs and returns to the command prompt.
e.g. If I then run Import-PSSession $PSSession, it imports the modules and returns me to the command prompt as expected.I haven't tried executing any further remote commands against Office 365 yet, except for the Invoke-Command listed above, which seems to behave as it should
Invoke-Command -Session $Session -ScriptBlock { get-mailbox -ResultSize 1 }This seems to give me a heap of information about my mailbox.
Again, thank you for the huge amount of work that must have gone in to supporting PowerShell on non-Windows platforms, and for the attention you have given to this particular issue.
I would like to see the dependance on Homebrew installed OpenSSL libraries eliminated for the reasons mentioned above. I will test the workaround of symlinking the libraries from MacPorts (which does play nicely with sudo and doesn't change the ownership of system directories).
For the final release version, is it likely that PowerShell will ship with all the required dependancies, or will it rely on these libraries to be installed via 3rd party package managers?
Kai Howells (@kai-h) Go ahead and file an issue MacPorts/Homebrew. Please include enough detail so a MacOS neophyte like myself can understand it. :)
Thanks again for all of your help tracking this down.
Dan Travison (@dantraMSFT) - I will do. Thanks.
I have logged issue #5634 regarding this.
- added a commit that references this issue
on Jan 5, 2018
I believe this is related to #942, which is closed. Someone claimed this works from Ubuntu. Is this not supported on macOS, or is this a bug?
Steps to reproduce
Expected behavior
Session would be initiated
Actual behavior
Environment data