PowerShell / PowerShell/PowerShell

pwsh.exe -NoProfile takes minutes to load after .NET update

Open
#23,830 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs-Triage
Dominant language
C#
Stars
55.5k
Forks
8.5k
Avg merge
1d 2h
Merged PRs (30d)
88

Description

Prerequisites
Steps to reproduce

I installed these updates yesterday:

image

Since then, PowerShell 7.4.2 takes about three minutes to load, even when I use pwsh.exe -NoProfile. Since there's no difference in behavior with or without loading the profile, here's an example when I do load with a profile so you can see the load time.

PowerShell 7.4.2
Loading personal and system profiles took 180574ms.

Even after loading, everything is glacially slow. For example:

PS C:\Users\Chad> Measure-Command { Get-Date }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 10
Milliseconds      : 11
Ticks             : 100117544
TotalDays         : 0.000115876787037037
TotalHours        : 0.00278104288888889
TotalMinutes      : 0.166862573333333
TotalSeconds      : 10.0117544
TotalMilliseconds : 10011.7544

Things I've tried:

  • pwsh.exe -NoProfile
  • pwsh.exe -NoProfile -NonInteractive
  • POWERSHELL_TELEMETRY_OPTOUT = 1 and POWERSHELL_UPDATECHECK = Off
  • Verified that Controlled Folder Access is set to Not configured (Issue https://github.com/PowerShell/PowerShell/issues/21546 has similar symptoms)
  • Reinstalled 7.4.2
Expected behavior
Acceptable performance
Actual behavior
As described above
Error details

No response

Environment data
Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the slowdown with pwsh.exe -NoProfile and Measure-Command { Get-Date } on the reported PowerShell 7.4.2 Windows environment, then compare startup with and without profiles. Review the symptoms and related issue #21546; done means startup and basic commands return to acceptable performance and the regression is covered by an appropriate test or diagnosis.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.