-
Notifications
You must be signed in to change notification settings - Fork 8.3k
RunspacePool mutates the PSModulePath #9921
Copy link
Copy link
Closed
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally 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 moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally 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 moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
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
ModuleIntrinsicssets the module path at constructor time:PowerShell/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Lines 41 to 47 in 66c628f
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.