Extend allowed Task.Delay/CTS TimeSpan values to match Timer (#43708)
authorStephen Toub <stoub@microsoft.com>
Thu, 22 Oct 2020 02:13:12 +0000 (22:13 -0400)
committerGitHub <noreply@github.com>
Thu, 22 Oct 2020 02:13:12 +0000 (22:13 -0400)
commit0e959bef48363f762ec7189db9b317d0a6d029b5
tree0f023ab9e16e5a7f8621c54450022ad339151f96
parent4731fdb6830141fb94fa8f3dbf81c437daa56ba9
Extend allowed Task.Delay/CTS TimeSpan values to match Timer (#43708)

For some reason, Task.Delay(TimeSpan, ...) and CancellationTokenSource.CancelAfter(TimeSpan) cut off the max allowed timeout at int.MaxValue milliseconds, whereas Timer's TimeSpan support (which is used under the covers) goes all the way to UInt32.MaxValue - 2.  This changes Task/CancellationTokenSource to match, effectively doubling the allowed length of the timeouts.
src/libraries/System.Private.CoreLib/src/Resources/Strings.resx
src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Timer.cs
src/libraries/System.Threading.Tasks/tests/CancellationTokenTests.cs
src/libraries/System.Threading.Tasks/tests/Task/TaskRtTests.cs