Skip to content

Fix empty WinGet update list on fresh launch + bump pinget to 0.9.0#4913

Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/pinget-update-list-race
Jun 11, 2026
Merged

Fix empty WinGet update list on fresh launch + bump pinget to 0.9.0#4913
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/pinget-update-list-race

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

On a cold start the WinGet update list was frequently empty or partial, only populating after a manual reload. _getAvailableUpdates runs pinget source update via Task.Run(RefreshPackageIndexes).Wait(60s) and then pinget upgrade; .Wait(timeout) does not cancel the task, so when source update runs longer than 60s the wait is abandoned and upgrade reads a half-rewritten index, returning 0 or partial results. The COM backend serialized winget access implicitly; the pinget/winget CLI backends did not.

Add WinGet.AcquireCliLock(), a static reentrant lock wrapping every CLI invocation (PingetCliHelper.RunJson, WinGet.RefreshPackageIndexes, WinGetCliHelper query methods, PingetCliPackageDetailsProvider.RunPinget) so upgrade waits for source update to finish instead of racing it. Lock acquisition is bounded (Monitor.TryEnter, 120s): a hung CLI process falls back to running unserialized rather than freezing all WinGet queries.

Also bump pinget to 0.9.0 (Cli.Rust for both apps, Core for the manager).

On a cold start the WinGet update list was frequently empty or partial,
only populating after a manual reload. _getAvailableUpdates runs
`pinget source update` via Task.Run(RefreshPackageIndexes).Wait(60s) and
then `pinget upgrade`; .Wait(timeout) does not cancel the task, so when
source update runs longer than 60s the wait is abandoned and upgrade reads
a half-rewritten index, returning 0 or partial results. The COM backend
serialized winget access implicitly; the pinget/winget CLI backends did not.

Add WinGet.AcquireCliLock(), a static reentrant lock wrapping every CLI
invocation (PingetCliHelper.RunJson, WinGet.RefreshPackageIndexes,
WinGetCliHelper query methods, PingetCliPackageDetailsProvider.RunPinget)
so upgrade waits for source update to finish instead of racing it. Lock
acquisition is bounded (Monitor.TryEnter, 120s): a hung CLI process falls
back to running unserialized rather than freezing all WinGet queries.

Also bump pinget to 0.9.0 (Cli.Rust for both apps, Core for the manager).
@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit 78da8c2 into main Jun 11, 2026
3 of 4 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the fix/pinget-update-list-race branch June 11, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants