Optimize PowerShell availability check: file existence fast path with automatic recovery#2596
Open
Optimize PowerShell availability check: file existence fast path with automatic recovery#2596
Conversation
…processes Co-authored-by: nagilson <23152278+nagilson@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize Powershell scan execution time
Optimize PowerShell availability check: file existence fast path before process spawning
Mar 3, 2026
nagilson
reviewed
Mar 3, 2026
vscode-dotnet-runtime-library/src/Acquisition/AcquisitionInvoker.ts
Outdated
Show resolved
Hide resolved
… test fails Co-authored-by: nagilson <23152278+nagilson@users.noreply.github.com>
Copilot
AI
changed the title
Optimize PowerShell availability check: file existence fast path before process spawning
Optimize PowerShell availability check: fast path with execution test and fallback to full validation
Mar 3, 2026
…lDotnet when PS process launch fails Co-authored-by: nagilson <23152278+nagilson@users.noreply.github.com>
Copilot
AI
changed the title
Optimize PowerShell availability check: fast path with execution test and fallback to full validation
Optimize PowerShell availability check: file existence fast path with automatic recovery
Mar 3, 2026
- Remove redundant SYSTEMROOT env var check (Node.js on Windows provides case-insensitive env var access) - Replace English-only stderr string matching with locale-independent error codes: ENOENT/EACCES/EPERM for OS-level failures, exit code 9009 for cmd.exe 'not recognized' errors - Skip retry when process was killed by signal (e.g. timeout) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…th check im thinking the full path check will be more successful because it doesn't require proper shell resolution or path environment setup to work and most people will have a proper systemroot environment variable.
nagilson
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human PR description by @nagilson:
Summary
Powershell is often not found / resolved properly on machines. This happens for about 6% of our (windows) customers.
Before, we resolved which powershell path worked before we ran the install script.
Prior Code:
Now:
We check if the file exists and run with the hard-coded powershell path without trying to verify powershell 'works' first, then fall back to checking for a working powershell and retry with that once.
file exists check median: ~0.2–1.4 ms
prior powershell.exe check median (on success): 335.1 ms
new full path exe check median ( on success): 75 ms
What this means:
Considering the number of users who run this code, this means with this change we collectively save about 20 days in time worth of startup delay in VS Code, per month.