11// Copyright (c) Microsoft Corporation.
22// Licensed under the MIT License.
33
4- using Microsoft . Extensions . Logging ;
5- using Microsoft . Extensions . Logging . Abstractions ;
6- using Microsoft . PowerShell . EditorServices . Hosting ;
7- using Microsoft . PowerShell . EditorServices . Services ;
8- using Microsoft . PowerShell . EditorServices . Services . PowerShellContext ;
9- using Microsoft . PowerShell . EditorServices . Test . Shared ;
104using System ;
115using System . Collections . Generic ;
126using System . IO ;
137using System . Management . Automation ;
148using System . Threading ;
159using System . Threading . Tasks ;
10+ using Microsoft . Extensions . Logging ;
11+ using Microsoft . Extensions . Logging . Abstractions ;
12+ using Microsoft . PowerShell . EditorServices . Hosting ;
13+ using Microsoft . PowerShell . EditorServices . Services ;
14+ using Microsoft . PowerShell . EditorServices . Services . PowerShellContext ;
15+ using Microsoft . PowerShell . EditorServices . Test . Shared ;
1616
1717namespace Microsoft . PowerShell . EditorServices . Test
1818{
@@ -32,6 +32,8 @@ internal static class PowerShellContextFactory
3232 Path . GetFullPath (
3333 TestUtilities . NormalizePath ( "../../../../PowerShellEditorServices.Test.Shared/ProfileTest.ps1" ) ) ) ;
3434
35+ public static System . Management . Automation . Runspaces . Runspace initialRunspace ;
36+
3537 public static PowerShellContextService Create ( ILogger logger )
3638 {
3739 PowerShellContextService powerShellContext = new PowerShellContextService ( logger , null , isPSReadLineEnabled : false ) ;
@@ -50,14 +52,15 @@ public static PowerShellContextService Create(ILogger logger)
5052 consoleReplEnabled : false ,
5153 usesLegacyReadLine : false ) ;
5254
53-
54- powerShellContext . Initialize (
55- TestProfilePaths ,
56- PowerShellContextService . CreateRunspace (
55+ initialRunspace = PowerShellContextService . CreateRunspace (
5756 testHostDetails ,
5857 powerShellContext ,
5958 new TestPSHostUserInterface ( powerShellContext , logger ) ,
60- logger ) ,
59+ logger ) ;
60+
61+ powerShellContext . Initialize (
62+ TestProfilePaths ,
63+ initialRunspace ,
6164 ownsInitialRunspace : true ,
6265 consoleHost : null ) ;
6366
0 commit comments