PowerShell / PowerShell/PowerShell

Progress bar debouncing ignores updates within a single update interval

Open
#24,728 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prerequisites
Steps to reproduce
& {
    [CmdletBinding()]param()

    $pr = [System.Management.Automation.ProgressRecord]::new(0, "activity", "description")

    # write the progress record once, which renders the progress bar and starts the 200 ms debounce timer
    $PSCmdlet.WriteProgress($pr)
    sleep 0.1

    # update progress record state and write it again - this write is ignored, and the progress bar still
    #  shows "description" instead of "new description", even after the 200 ms debounce timer expires
    $pr.StatusDescription = "new description"
    $PSCmdlet.WriteProgress($pr)
    sleep 1
}
Expected behavior

Progress bar briefly flashes with description and then changes to new description. Even if the update is not picked up immediately, I'd expect that the updated progress bar state should be stored and rendered on the next repaint after the debounce timer expires.

Actual behavior

Progress bar is stuck on description and new description never shows.

Environment data
Name                           Value
----                           -----
PSVersion                      7.3.0-preview.2
PSEdition                      Core
GitCommitId                    7.3.0-preview.2
OS                             Microsoft Windows 10.0.19045
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

Start with the supplied PowerShell reproduction using ProgressRecord and $PSCmdlet.WriteProgress, then trace the progress rendering and 200 ms debounce path. Done means the second status update is retained and appears on the next repaint instead of leaving the bar stuck on the original description.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.