Mpdreamz / shellprogressbar

ShellProgressBar - display progress in your console application
MIT License
1.43k stars 134 forks source link

Bug in ProgressBarBase.Tick() #18

Closed jcrivello closed 6 years ago

jcrivello commented 6 years ago

Hello!

Thanks for the great work on this project. Nice little library, very useful.

I discovered a bug in ProgressBarBase.Tick() in the latest version of the library that is published to NuGet (4.0.0). When you call Tick() with a newTickCount that is equal to the current tick count, the method doesn't simply leave the tick count unchanged -- it increments the tick count by one.

This caused some very strange behavior in my application, where a parent progress bar percentage occasionally appeared to be rolling back for a split second. This was occurring because the increment in progress for the child task was large enough to increase the tick for the child progress bar, but not for the parent progress bar. This resulted in a call to Tick() for the parent progress bar with a newTickCount equal to the current tick count, which caused the tick count to unexpectedly increment by one. If another small progress update occurred shortly thereafter, it would update the tick count to the original value -- causing it to appear to roll back by one tick.

Joe