Skip to content

Write-Progress drops updates if the calls happen too quickly in succession #18848

@mklement0

Description

@mklement0

Prerequisites

Steps to reproduce

Note: This is a regression from Windows PowerShell and affects both the Minimal and Classic views (selectable via $PSStyle.Progress.View)

$arr = 1..10
$arr | 
  ForEach-Object { 
    [int] $percentComplete = ($_ / $arr.Count) * 100
    Write-Progress -Activity Test -Status "$percentComplete% complete" -PercentComplete $percentComplete
    # !! Without sleeping for a while, the progress display stops updating after the FIRST call.
    # Start-Sleep -Milliseconds 200
  }
Start-Sleep 5 # Ensure that the progress bar stays visible for a while.

Expected behavior

The progress bar should show 100% and stay visible for 5 seconds.

Actual behavior

The progress bar shows 10% - that is, only the first call took effect.

Error details

No response

Environment data

PowerShell Core 7.3.1

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions