Skip to content

Commit

Permalink
Merge pull request #431 from daviwil/fix-vsc-632
Browse files Browse the repository at this point in the history
Fix debugger startup hang when session still initializing
  • Loading branch information
daviwil authored Apr 7, 2017
2 parents f862b8c + 160c2d1 commit 885dcab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ protected async Task HandleLaunchRequest(
// TODO: What's the right approach here?
if (this.editorSession.PowerShellContext.CurrentRunspace.Location == RunspaceLocation.Local)
{
editorSession.PowerShellContext.SetWorkingDirectory(workingDir);
await editorSession.PowerShellContext.SetWorkingDirectory(workingDir);
Logger.Write(LogLevel.Verbose, "Working dir set to: " + workingDir);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected async Task HandleInitializeRequest(
// Set the working directory of the PowerShell session to the workspace path
if (editorSession.Workspace.WorkspacePath != null)
{
editorSession.PowerShellContext.SetWorkingDirectory(
await editorSession.PowerShellContext.SetWorkingDirectory(
editorSession.Workspace.WorkspacePath);
}

Expand Down
7 changes: 5 additions & 2 deletions src/PowerShellEditorServices/Session/PowerShellContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1048,9 +1048,12 @@ internal void ReleaseRunspaceHandle(RunspaceHandle runspaceHandle)
/// unescaped before calling this method.
/// </summary>
/// <param name="path"></param>
public void SetWorkingDirectory(string path)
public async Task SetWorkingDirectory(string path)
{
this.CurrentRunspace.Runspace.SessionStateProxy.Path.SetLocation(path);
using (RunspaceHandle runspaceHandle = await this.GetRunspaceHandle())
{
runspaceHandle.Runspace.SessionStateProxy.Path.SetLocation(path);
}
}

/// <summary>
Expand Down

0 comments on commit 885dcab

Please sign in to comment.