Skip to content

Commit 7ddfb8e

Browse files
committed
Use explicit arguments in PSSA PowerShell creation
1 parent 8656393 commit 7ddfb8e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PowerShellEditorServices/Services/Analysis/PssaCmdletAnalysisEngine.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ private Task<PowerShellResult> InvokePowerShellAsync(PSCommand command)
326326

327327
private PowerShellResult InvokePowerShell(PSCommand command)
328328
{
329-
using (var powerShell = System.Management.Automation.PowerShell.Create())
329+
using (var powerShell = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
330330
{
331331
powerShell.RunspacePool = _analysisRunspacePool;
332332
powerShell.Commands = command;
@@ -441,7 +441,7 @@ private IEnumerable<string> GetPSScriptAnalyzerRules()
441441
/// <returns>A runspace pool with PSScriptAnalyzer loaded for running script analysis tasks.</returns>
442442
private static RunspacePool CreatePssaRunspacePool(out PSModuleInfo pssaModuleInfo)
443443
{
444-
using (var ps = System.Management.Automation.PowerShell.Create())
444+
using (var ps = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
445445
{
446446
// Run `Get-Module -ListAvailable -Name "PSScriptAnalyzer"`
447447
ps.AddCommand("Get-Module")

0 commit comments

Comments
 (0)