Skip to content

Exception encountered starting EditorServices. Exception logged in C:\__w\1\s\src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line 239 in EndProcessing: #5118

@KevinWGagel

Description

@KevinWGagel

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

Whenever I open VSCode with an open script that is using Windows PowerShell 5.1 OR switch to PowerShell 5.1 the terminal crashes and waits for me to press a key. After the key press, VSCode loads PowerShell 7.x.

Exception encountered starting EditorServices. Exception logged in C:\__w\1\s\src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line 239 in EndProcessing: System.MissingMethodException: Method not found: 'Microsoft.Extensions.Logging.ILoggerFactory Serilog.SerilogLoggerFactoryExtensions.AddSerilog(Microsoft.Extensions.Logging.ILoggerFactory, Serilog.ILogger, Boolean)'. at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesServerFactory.Create(String logDirectoryPath, Int32 minimumLogLevel, IObservable1 hostLogger)
at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesRunner..ctor(HostLogger logger, EditorServicesConfig config, ISessionFileWriter sessionFileWriter, IReadOnlyCollection`1 loggersToUnsubscribe)
at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LoadAndRunEditorServicesAsync()
at Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()

== Press any key to close terminal ==`

PowerShell Version

Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.1.22621.4391                                                                          
PSEdition                      Desktop                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.22621.4391                                                                         
CLRVersion                     4.0.30319.42000                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1

Visual Studio Code Version

1.96.1
x64

Extension Version

ms-vscode.powershell@2024.4.0

Steps to Reproduce

Open a PS Script and switch to PowerShell 5.1.

Visuals

Terminal Startup Error With PS 5 1 Error Message
Terminal Startup Error With PS 5 1

Logs

PowerShellEditorServices-35808.log
PowerShellEditorServices-53948.log
StartEditorServices-35808.log
StartEditorServices-48004.log
StartEditorServices-52552.log
StartEditorServices-53948.log
vscode-powershell.log
StartEditorServices-22268.log
PowerShellEditorServices-9424.log
StartEditorServices-9424.log
StartEditorServices-52636.log
PowerShellEditorServices-20056.log
StartEditorServices-20056.log
PowerShellEditorServices-21664.log
StartEditorServices-23680.log
StartEditorServices-21664.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugA bug to squash.Needs: TriageMaintainer attention needed!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions