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.
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.