PowerShell / PowerShell/PowerShell

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

未關閉
#23,830 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

Needs-Triage
主要語言
C#
星號
55.5k
分支
8.5k
平均合併
1 天 2 小時
30 天內合併 PR
88

描述

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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

在回報的 PowerShell 7.4.2 Windows 環境中,使用 pwsh.exe -NoProfile 和 Measure-Command { Get-Date } 重現變慢問題,然後比較有 profile 和沒有 profile 時的啟動情況。檢視相關症狀和 issue #21546;當啟動和基本命令恢復到可接受的效能,且此回歸由適當的測試或診斷涵蓋時,即視為完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
powershell
領域
cli, performance
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。