Repository navigation
New-PSSession still fails with a NullReferenceException on macOS #4029
Copy link
Copy link
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productOS-macOSResolution-FixedThe issue is fixed.The issue is fixed.WG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer
Milestone
Description
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
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Expected behavior
Session would be initiated
Actual behavior
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
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-beta
PSEdition Core
BuildVersion 3.0.0.0
CLRVersion
GitCommitId v6.0.0-beta.2
OS Darwin 17.0.0 Darwin Kernel Version 17.0.0: Mon May 29 20:35:...
Platform Unix
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
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productOS-macOSResolution-FixedThe issue is fixed.The issue is fixed.WG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer
Activity
tthoma24 commentedon Jun 17, 2017
#3476 may also be related, same issue on CentOS, and another reporter on macOS.
tthoma24 commentedon Aug 1, 2017
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.
kai-h commentedon Nov 22, 2017
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.
iSazonov commentedon Nov 23, 2017
Steve Lee (@SteveL-MSFT) Related Issue #3476 was labeled as GA. Should we fix current Issue before GA too?
SteveL-MSFT commentedon Nov 23, 2017
Dan Travison (@dantraMSFT) can you confirm with latest psl-omi-provider this works on macOS?
dantraMSFT commentedon Nov 28, 2017
Kai Howells (@kai-h) Are you able to consistently repro the NullReferenceException? I'm not able to repro it.
kai-h commentedon Nov 28, 2017
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.
kai-h commentedon Nov 28, 2017
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 commentedon Nov 28, 2017
Thanks, Kai Howells (@kai-h), let me checkout out the pkg page.
dantraMSFT commentedon Nov 28, 2017
Kai 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
dantraMSFT commentedon Dec 4, 2017
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.
kai-h commentedon Dec 4, 2017
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.
kai-h commentedon Dec 4, 2017
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.
dantraMSFT commentedon Dec 4, 2017
Kai Howells (@kai-h): The updated binary and pdb file is on dropbox.
kai-h commentedon Dec 6, 2017
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
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?
dantraMSFT commentedon Dec 6, 2017
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.
kai-h commentedon Dec 6, 2017
Dan Travison (@dantraMSFT) - I will do. Thanks.
kai-h commentedon Dec 6, 2017
I have logged issue #5634 regarding this.
remoting: Handle DLLImport failure of libpsrpclient (#5622)
remoting: Handle DLLImport failure of libpsrpclient (PowerShell#5622)
remoting: Handle DLLImport failure of libpsrpclient (#5622)
remoting: Handle DLLImport failure of libpsrpclient (PowerShell#5622)
remoting: Handle DLLImport failure of libpsrpclient (PowerShell#5622)