Skip to content

Commit 01fdc37

Browse files
Workaround "attach to process" hang (#846)
* workaround attach problems * use string compare since type is not in PSv3 * Update src/PowerShellEditorServices/Session/RunspaceDetails.cs * use full assembly name * null check
1 parent 7e559d4 commit 01fdc37

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/PowerShellEditorServices/Session/RunspaceDetails.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,11 @@ internal static RunspaceDetails CreateFromRunspace(
225225
defaultValue: string.Empty);
226226

227227
// hostname is 'ServerRemoteHost' when the user enters a session.
228-
// ex. Enter-PSSession, Enter-PSHostProcess
229-
if (hostName.Equals("ServerRemoteHost", StringComparison.Ordinal))
228+
// ex. Enter-PSSession
229+
// Attaching to process currently needs to be marked as a local session
230+
// so we skip this if block if the runspace is from Enter-PSHostProcess
231+
if (hostName.Equals("ServerRemoteHost", StringComparison.Ordinal)
232+
&& runspace.OriginalConnectionInfo?.GetType().ToString() != "System.Management.Automation.Runspaces.NamedPipeConnectionInfo")
230233
{
231234
runspaceLocation = RunspaceLocation.Remote;
232235
connectionString =

0 commit comments

Comments
 (0)