Skip to content

[Bug]: TimeSpan -0.001 in TimeoutRejectedException #2815

@czmirek

Description

@czmirek

Describe the bug

For the following code:

PolicyResult result = await Policy.TimeoutAsync(5).ExecuteAndCaptureAsync(async (ct) =>
{
    await Task.Delay(TimeSpan.FromSeconds(10), ct);
}, CancellationToken.None);

Console.WriteLine(((TimeoutRejectedException)result.FinalException).Timeout);
Console.ReadLine();

Expected behavior

I expect the console output to be

00:00:05.0000000

Or at least something within reasonable error around the value of 5 seconds.

Actual behavior

It is instead -00:00:00.0010000.

Polly version

8.6.4

.NET Version

.NET 10

Anything else

I hope this is not me misunderstanding the usage...but honestly I have no idea where the value -0.001 seconds is coming from.

Metadata

Metadata

Labels

bughelp wantedA change up for grabs for contributions from the community

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions