diff --git a/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs b/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs index 6780b019a..599453546 100644 --- a/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs +++ b/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs @@ -1161,12 +1161,12 @@ public async Task LoadHostProfilesAsync() if (this.profilePaths != null) { // Load any of the profile paths that exist + var command = new PSCommand(); foreach (var profilePath in GetLoadableProfilePaths(this.profilePaths)) { - PSCommand command = new PSCommand(); - command.AddCommand(profilePath, false); - await this.ExecuteCommandAsync(command, sendOutputToHost: true, sendErrorToHost: true).ConfigureAwait(false); + command.AddCommand(profilePath, false).AddStatement(); } + await ExecuteCommandAsync(command, sendOutputToHost: true).ConfigureAwait(false); // Gather the session details (particularly the prompt) after // loading the user's profiles.