Skip to content

Commit e85f09d

Browse files
committed
Use explicit arguments in PSSA PowerShell creation
1 parent eacb93c commit e85f09d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PowerShellEditorServices/Services/Analysis/PssaCmdletAnalysisEngine.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ private Task<PowerShellResult> InvokePowerShellAsync(PSCommand command)
328328

329329
private PowerShellResult InvokePowerShell(PSCommand command)
330330
{
331-
using (var powerShell = System.Management.Automation.PowerShell.Create())
331+
using (var powerShell = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
332332
{
333333
powerShell.RunspacePool = _analysisRunspacePool;
334334
powerShell.Commands = command;
@@ -443,7 +443,7 @@ private IEnumerable<string> GetPSScriptAnalyzerRules()
443443
/// <returns>A runspace pool with PSScriptAnalyzer loaded for running script analysis tasks.</returns>
444444
private static RunspacePool CreatePssaRunspacePool(out PSModuleInfo pssaModuleInfo)
445445
{
446-
using (var ps = System.Management.Automation.PowerShell.Create())
446+
using (var ps = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
447447
{
448448
// Run `Get-Module -ListAvailable -Name "PSScriptAnalyzer"`
449449
ps.AddCommand("Get-Module")

0 commit comments

Comments
 (0)