diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs index 2bec67fe9..77bae18a3 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousDelegateTask.cs @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Microsoft.Extensions.Logging; -using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using System; using System.Threading; +using Microsoft.Extensions.Logging; +using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host; using SMA = System.Management.Automation; namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution @@ -23,7 +23,7 @@ public SynchronousDelegateTask( CancellationToken cancellationToken) : base(logger, cancellationToken) { - ExecutionOptions = executionOptions ?? new ExecutionOptions(); + ExecutionOptions = executionOptions ?? s_defaultExecutionOptions; _representation = representation; _action = action; } @@ -58,7 +58,7 @@ public SynchronousDelegateTask( { _func = func; _representation = representation; - ExecutionOptions = executionOptions ?? new ExecutionOptions(); + ExecutionOptions = executionOptions ?? s_defaultExecutionOptions; } public override ExecutionOptions ExecutionOptions { get; } @@ -94,7 +94,7 @@ public SynchronousPSDelegateTask( _psesHost = psesHost; _action = action; _representation = representation; - ExecutionOptions = executionOptions ?? new ExecutionOptions(); + ExecutionOptions = executionOptions ?? s_defaultExecutionOptions; } public override ExecutionOptions ExecutionOptions { get; } @@ -131,7 +131,7 @@ public SynchronousPSDelegateTask( _psesHost = psesHost; _func = func; _representation = representation; - ExecutionOptions = executionOptions ?? new ExecutionOptions(); + ExecutionOptions = executionOptions ?? s_defaultExecutionOptions; } public override ExecutionOptions ExecutionOptions { get; } diff --git a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs index c3a1132ad..f683c95a3 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Execution/SynchronousPowerShellTask.cs @@ -25,6 +25,8 @@ internal class SynchronousPowerShellTask : SynchronousTask