Skip to content

Properly disable (if/def out) all code related to session connection/disconnection for Unix builds #7008

@daxian-dbw

Description

@daxian-dbw

This issue is opened based on the comment in PR #6939.

Class QueryRunspaces and enum SessionFilterState from ConnectPSSession.cs

QueryRunspaces is only used for session disconnect, which is only supported on Windows. PSRemotingCmdlets.cs is a heavily loaded file to support many remoting cmdlet base classes. Moving QueryRunspaces there just makes it more bloated and confusing in my opinion.
I feel that QueryRunspaces should be put into a separate utils file that can be skipped for Linux.
You should also #ifdef out its use in the Get-PSSession parameter set since it is not supported on Linux.

The type QueryRunspaces is only for session connection/disconnection. It's used in Connect-PSSession/Receive-PSSession/Get-PSSession and it's also directly used by the abstract class PSRunspaceCmdlet from PSRemotingCmdlet.cs. Now Connect-PSSession and Receive-PSSession are disabled in Unix build, but QueryRunspaces is still used in Get-PSSession (in getrunspacecommand.cs) and PSRunspaceCmdlet (in PSRemotingCmdlet.cs), even though the connenction/disconnection feature is not available on Unix platforms.

So, we need to properly disable all code realted to session connection/disconnection for Unix build, and then, as @PaulHigin suggested in the comment, QueryRunspaces and SessionFilterState probably should be moved a separate file that can be skipped for Unix build compilation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Maintainers-Buildspecific to affecting the buildIssue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalityResolution-No ActivityIssue has had no activity for 6 months or more

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions