Skip to content

RunspacePool mutates the PSModulePath #9921

@rjmholt

Description

@rjmholt

From PowerShell/vscode-powershell#2008.

Related to #6850.

When using a RunspacePool (common in hosted and remote contexts), the PSModulePath gets reset whenever a runspace is opened.

This occurs because ModuleIntrinsics sets the module path at constructor time:

internal ModuleIntrinsics(ExecutionContext context)
{
_context = context;
// And initialize the module path...
SetModulePath();
}

as if it were a process-singleton.

Every time a runspace is opened in PowerShell, the whole process gets its PSModulePath reset, which is a problem for things like EditorServices where we use a runspace to run analysis in the background, but users expect to be able to modify the PSModulePath in the IntegratedConsole.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions