Skip to content

ProgressTask.GetPercentage() throws a division by 0 exception when MaxValue is 0 #981

@benzmarkus

Description

@benzmarkus

In my project the maxValue has 0 and the value is 0. The percentage calculation is then a division by 0 and the result percentage should be 0 too but it's -2,147,483,647

private double GetPercentage()
{
var percentage = (Value / MaxValue) * 100;
percentage = Math.Min(100, Math.Max(0, percentage));
return percentage;
}


Please upvote 👍 this issue if you are interested in it.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions