Repository navigation
2024.4.0: Unable to start when using Windows PowerShell if older Serilog is already present #5084
Description
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
Attempting to launch vscode's powershell extension and get an error. Googling found others with the same issue.
PowerShell Version
Name Value
---- -----
PSVersion 5.1.22621.4249
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.4249
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1Visual Studio Code Version
1.95.1
x64Extension Version
ms-vscode.powershell@2024.4.0Steps to Reproduce
Launch vscode, get the following error:
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, IReadOnlyCollection1 loggersToUnsubscribe)
at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesLoader.LoadAndRunEditorServicesAsync()
at Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()
Visuals
No response
Logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
JustinGrote commentedon Nov 7, 2024
Andy Jackson (@ajacks88) thanks for your submission!
We can't reproduce, maybe you can help us narrow down your environment. The nature of this error almost always means that something else in your environment is loading an older or otherwise incompatible

Microsoft.Extensions.Loggingassembly before the PowerShell Editor Services starts.CC Andy Jordan (@andyleejordan) for 👀
JustinGrote commentedon Nov 7, 2024
Andy Jordan (@andyleejordan) I think it might be time for us to start catching these methodNotFound exceptions during startup and reporting some added guidance in this regard.
Azburkabas commentedon Nov 7, 2024
I have the same problem. After update to v.2024.4.0 it can not load powershell 5.1 sessions (powershell 7 works but I need pwsh 5.1).
Error code:
The terminal process "C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\powershell.exe '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', 'Import-Module 'c:\Users\xxxxxxxxx.vscode\extensions\ms-vscode.powershell-2024.5.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2024.5.0' -BundledModulesPath 'c:\Users\xxxxxxxx.vscode\extensions\ms-vscode.powershell-2024.5.0\modules' -EnableConsoleRepl -StartupBanner "PowerShell Extension v2024.5.0
Copyright (c) Microsoft Corporation.
https://aka.ms/vscode-powershell
Type 'help' to get help.
" -LogLevel 'Normal' -LogPath 'c:\Users\xxxxxxx\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\1730969275-a948b417-6923-477c-a612-450319746a041730968940191' -SessionDetailsPath 'c:\Users\xxxxxx\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-21020-286160.json' -FeatureFlags @() '" terminated with exit code: 1.
[ERROR] - PowerShell Language Server process didn't start!
When i roll back to v2024.2.2 it works just fine.
Phillip-Ian commentedon Nov 7, 2024
Nothing new to add, just reinforcing the issue. Exact same symptoms, and rolling back to v2024.2.2 did the trick.
JustinGrote commentedon Nov 9, 2024
Andy Jackson (@ajacks88) Chris (@Phillip-Ian) Azburkabas we can't reproduce this anywhere, so we have to figure out what is different about your environment.
11 remaining items
JustinGrote commentedon Nov 13, 2024
#2538 reopened for historical as well, should be addressed and closed with whatever PR fixes this.
JustinGrote commentedon Nov 13, 2024
For anyone else potentially experiencing this issue, please capture a diagnostic trace and upload to this issue. If you aren't getting the MEL logger exception, your issue may be different, but this is most likely being caused by the Serilog version bump as Andy Jordan (@andyleejordan) noted.
[-]Unable to launch powershell extension terminal after vscode update today[/-][+]2024.4.0: Unable to start when using Windows PowerShell if older Serilog is already present[/+]JustinGrote commentedon Nov 14, 2024
Hopefully PowerShell/PowerShellEditorServices#2197 fixes this. In the meantime please downgrade to the previous version.
JustinGrote commentedon Nov 14, 2024
Hey everyone, thanks for your patience, Andy Jordan (@andyleejordan) should get out a preview release tomorrow that should have this fixed, we will notify here and if you still have issues let us know.
jsantoro339as commentedon Nov 18, 2024
After updating the extension to the preview release I now get the following error
hell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()
== Press any key to close terminal ==
Start-EditorServices : Method not found: 'Microsoft.Extensions.Logging.ILoggerFactory Serialog.SerialogLoggerFactoryExtensions.AddSerialog(Microsoft.Extensions.Logging.ILoggerFactory, Serialog.ILogger, Boolean)'.
At line:1 char:148
+...ices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' ...
+
+ CategoryInfo : NotSpecified: (Microsoft.Power...ServicesCommand:StartEditorServicesCommand) [Start-EditorServices], MissingMethodException
+ FullyQualifiedErrorId : PowerShellEditorServicesError,Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand
JustinGrote commentedon Nov 18, 2024
jsantoro339as the new prerelease hasn't been released yet, very soon! We ran into an internal verification build problem, I expect Andy Jordan (@andyleejordan) will get that sorted today or tomorrow.
JustinGrote commentedon Nov 19, 2024
It's out! Go to your extensions and choose "switch to pre-release" in the right click menu and let us know if this fixes it for you!
jsantoro339as commentedon Nov 19, 2024
Justin Grote (@JustinGrote) Yes, I just updated it and it is working again. Thank you team, for addressing the issue and getting the fix out.
andyleejordan commentedon Nov 19, 2024
So glad to hear it!
andyleejordan commentedon Nov 19, 2024
Hey Andy Jackson (@ajacks88) Azburkabas Chris (@Phillip-Ian) the fix for this is in the pre-release version of the extension, can you all please give it a try? Thanks!