diff --git a/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs b/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs index 37d791198..c55727693 100644 --- a/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs +++ b/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs @@ -215,7 +215,8 @@ protected async Task HandleInitializeRequestAsync( 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.SetWorkingDirectoryAsync( editorSession.Workspace.WorkspacePath,