Skip to content

Conversation

@PaulHigin
Copy link
Contributor

PR Summary

This PR removes the apartment thread state check when invoking a script on a PowerShell object for non-Windows platforms.

PR Context

I found this while testing SSH remoting on non-Windows platforms. Entering into an interactive session on an SSH remote connection between PS6 and PS7 results in an error. The error is due to the apartment thread state check, which should not apply to UNIX platforms. This is a regression.

The fix is to simply remove the check since it is not needed for UNIX platforms.

# PS 6 on Ubuntu platform making a remote connection to PS 7 on Ubuntu platform.
PS > $session = New-PSSession -Host UbuntuPS7
PS > Enter-PSSession $session
Enter-PSSession : When the runspace is set to use the current thread, the apartment state in the invocation settings must match that of the current thread.
At line:1 char:1
+ Enter-PSSession -Session $s
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Enter-PSSession], InvalidOperationException
+ FullyQualifiedErrorId : RemotePSInvocationStateInfoReason

PR Checklist

@ghost ghost assigned daxian-dbw Dec 9, 2019
@PaulHigin PaulHigin requested a review from SteveL-MSFT December 9, 2019 19:04
@PaulHigin PaulHigin added this to the rc.1-consider milestone Dec 9, 2019
@daxian-dbw daxian-dbw merged commit c232903 into PowerShell:master Dec 10, 2019
@PaulHigin PaulHigin deleted the fix-non-windows-apartmentstate-check branch December 10, 2019 15:38
@TravisEz13 TravisEz13 modified the milestones: rc.1-approved, 7.0.0-rc.1 Dec 11, 2019
@daxian-dbw daxian-dbw added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Dec 14, 2019
@ghost
Copy link

ghost commented Dec 16, 2019

🎉v7.0.0-rc.1 has been released which incorporates this pull request.:tada:

Handy links:

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

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants