diff --git a/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs b/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs index 41dfb4181..d582a7084 100644 --- a/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs +++ b/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs @@ -226,7 +226,8 @@ protected async Task HandleInitializeRequest( editorSession.Workspace.WorkspacePath = initializeParams.RootPath; // Set the working directory of the PowerShell session to the workspace path - if (editorSession.Workspace.WorkspacePath != null) + if (editorSession.Workspace.WorkspacePath != null + && Directory.Exists(editorSession.Workspace.WorkspacePath)) { await editorSession.PowerShellContext.SetWorkingDirectory( editorSession.Workspace.WorkspacePath,