Microsoft has made a complete overhaul of the core PowerShell engine to create a more reliable and stable user experience.
The release of the updated PowerShell extension in VS Code includes a rewrite of PowerShell pipeline execution with cancellable and ordered tasks, many debugger reliability improvements, a ReadKey fix that includes better pasting on macOS and Linux, and many more improvements.
Previously, the integrated Console was run by setting threadpool tasks on a shared main workspace which lead to threading issues and a complex implementation intended to work around the asymmetry between PowerShell as a runtime and as a language server.
Now, PowerShell Editor Services maintains its own dedicated pipeline thread which prevents an entire class of race conditions, leading to more reliable and bug-free code. Developers can also directly call PowerShell APIs and code written in C# from this thread, without the overhead of a PowerShell pipeline, which further improves the performance.
“This change has overhauled how we service [Language Server Protocol] requests, how the Integrated Console works, how PSReadLine is integrated, how debugging is implemented, how remoting is handled, and a long tail of other features in PowerShell Editor Services,” Sydney Smith, program manager at PowerShell, wrote in a blog post.