Skip to content

Write-Progress incorrectly shows 100% until 1% of the task is completed #18850

Closed
@wi-fr

Description

@wi-fr

Prerequisites

Steps to reproduce

for ($i = 0; $i -le 2; $i += 0.1) { 
  Write-Progress -Activity 'DEMO' -Status $i -PercentComplete ([int]$i)
  Start-Sleep 1
}


### Expected behavior

```console
The progress bar shows 0% before 1% of the task is completed.

Actual behavior

The progress bar shows 100% before 1% of the task is completed.

In Windows PowerShell 5.1 the code snippet works as expected.

Error details

No error

Environment data

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.1
PSEdition                      Core
GitCommitId                    7.3.1
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions