You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am using Progress while I am looping through a collection of items to process. It may take a couple of seconds to process each item in the loop. If the first item does not call task.Increment() shortly after creating the task, then Progress throws an OverflowException.
Unhandled exception. System.OverflowException: TimeSpan overflowed because the duration is too long.
at System.TimeSpan.Interval(Double value, Double scale)
at System.TimeSpan.FromSeconds(Double value)
at Spectre.Console.ProgressTask.GetRemainingTime() in /_/src/Spectre.Console/Progress/ProgressTask.cs:line 269
at Spectre.Console.ProgressTask.get_RemainingTime() in /_/src/Spectre.Console/Progress/ProgressTask.cs:line 90
at Spectre.Console.RemainingTimeColumn.Render(RenderContext context, ProgressTask task, TimeSpan deltaTime) in /_/src/Spectre.Console/Progress/Columns/RemainingTimeColumn.cs:line 23
at Spectre.Console.Internal.DefaultProgressRenderer.<>c__DisplayClass12_1.<Update>b__0(ProgressColumn column) in /_/src/Spectre.Console/Progress/Renderers/DefaultProgressRenderer.cs:line 96
at System.Linq.Enumerable.SelectListIterator`2.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Spectre.Console.Internal.DefaultProgressRenderer.Update(ProgressContext context) in /_/src/Spectre.Console/Progress/Renderers/DefaultProgressRenderer.cs:line 96
at Spectre.Console.ProgressContext.Refresh() in /_/src/Spectre.Console/Progress/ProgressContext.cs:line 59
at Spectre.Console.Internal.ProgressRefreshThread.Run() in /_/src/Spectre.Console/Progress/ProgressRefreshThread.cs:line 46
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ThreadHelper.ThreadStart()
Expected behavior
No exception should be thrown if tasks are taking a while. Progress Column should handle a "max value" estimated time remaining.
Screenshots
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered:
When calculating the remaining time for a progress task,
we divide the value delta with the current speed.
If the speed is zero, then the resulting double will
be 'infinity' which will lead to TimeSpan.FromSeconds
throwing.
This commit fixes that bug by setting the speed to 1
if it's 0 when calculating the remaining time.
Closes#169
Information
Describe the bug
I am using Progress while I am looping through a collection of items to process. It may take a couple of seconds to process each item in the loop. If the first item does not call
task.Increment()
shortly after creating the task, then Progress throws an OverflowException.To Reproduce
This ends up with the following exception:
Expected behavior
No exception should be thrown if tasks are taking a while. Progress Column should handle a "max value" estimated time remaining.
Screenshots
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: