PowerShell / PSReadLine

A bash inspired readline implementation for PowerShell
BSD 2-Clause "Simplified" License
3.76k stars 298 forks source link

Visual Studio Code fails to launch PowerShell terminal on startup #4258

Closed hisae1421 closed 2 weeks ago

hisae1421 commented 2 weeks ago

Prerequisites

Exception report

Every time I open Visual Studio Code I have the following error message in the PowerShell terminal :
"
Exception encountered starting EditorServices. Exception logged in C:\__w\1\s\src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line 239 in EndProcessing:
System.MissingMethodException: Méthode introuvable : 'Microsoft.Extensions.Logging.ILoggerFactory Serilog.SerilogLoggerFactoryExtensions.AddSerilog(Microsoft.Extensions.Logging.ILoggerFactory, Serilog.ILogger, Boolean)'.
   à Microsoft.PowerShell.EditorServices.Hosting.EditorServicesServerFactory.Create(String logDirectoryPath, Int32 minimumLogLevel, IObservable`1 hostLogger)
   à Microsoft.PowerShell.EditorServices.Hosting.EditorServicesRunner..ctor(HostLogger logger, EditorServicesConfig config, ISessionFileWriter sessionFileWriter, IReadOnlyCollection`1 loggersToUnsubscribe)   
   à Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LoadAndRunEditorServicesAsync()
   à Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()

== Press any key to close terminal ==
"

I reinstalled both Visual Studio Code and the PowerShell module

Here are the environment info :
Version : 1.95.1 (user setup)
Validation : 65edc4939843c90c34d61f4ce11704f09d3e5cb6
Date : 2024-10-31T05:14:54.222Z
Electron : 32.2.1
ElectronBuildId : 10427718
Chromium : 128.0.6613.186
Node.js : 20.18.0
V8 : 12.8.374.38-electron.0
Système d’exploitation : Windows_NT x64 10.0.19045

Screenshot

image

Environment data

PS Version: 5.1.19041.5007
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.4522 (WinBuild.160101.0800)
BufferWidth: 226
BufferHeight: 34

Steps to reproduce

Visual Studio launches PowerShell terminal

Expected behavior

I don't understand.... Expected behavior is not to have an error message I guess ?

Actual behavior

Shows the error message above

github-actions[bot] commented 2 weeks ago

@hisae1421, you were using a pretty old version of PSReadLine (2.0.0-beta2 or prior), and it's likely that the issue was fixed in a newer version. Please upgrade to the 2.3.5 version of PSReadLine from PowerShell Gallery. See the upgrading section for instructions. Please let us know if you run into the same issue with the latest version.

hisae1421 commented 2 weeks ago

Hi, I use the latest already : image

Has to be something else :( this is from the visual studio code that shows me the issue every time by the way, not another PowerShell environment

Growbutski commented 1 week ago

Hi, I seem to run in to the same issue:

image

Growbutski commented 1 week ago

I only get the error in the new powershell extension version. Version 2024.4.0 works fine.

hisae1421 commented 1 week ago

I also have it when i revert back to older version but indeed the issue started last week, probably when 2024.5.0 got deployed

hisae1421 commented 1 week ago

I solved it by installing PowerShell 7 but I don't understand why vsCode extension is not compliant anymore with my default 5.1 powershell environement

hisae1421 commented 1 week ago

Why can't I set this issue to opened ? Some bot said something wrong about it and that's it ? Archived forever ? 😂

daxian-dbw commented 1 week ago

@hisae1421 and @Growbutski The exception indicates it's a problem with PS VSCode extension, not PSReadLine. Please report your issue in https://github.com/PowerShell/vscode-powershell instead.