Direct: IdleTcpConnectionTimeout TimeSpan contract not honoring sub-second and fractional values (mirror of #4500)
needs-investigationcustomer-reported
## Description
`IdleTcpConnectionTimeout` has the same silent truncation issue that was fixed for `OpenTcpConnectionTimeout` in #5873 (Fixes #4500).
At `DocumentClient.cs:925`, the conversion is:
```csharp
this.idleConnectionTimeoutInSeconds = (int)connectionPolicy.IdleTcpConnectionTimeout.Value.TotalSeconds;
```
This `(int)` cast silently truncates:
- Sub-second values (e.g. `TimeSpan.FromMilliseconds(500)`) to 0
- Fractional values >= 1s (e.g. `TimeSpan.FromSeconds(10.5)`) down to the next whole second
- Negative values to 0
Additionally, the public setter on `CosmosClientOptions.IdleTcpConnectionTimeout` does not validate for negative values.
## Expected behavior
Apply the same contract as `OpenTcpConnectionTimeout` (per #5873):
- Negative `TimeSpan` should throw `ArgumentOutOfRangeException` at the setter.
- Sub-second values should normalize to 0 at the transport boundary.
- Fractional values >= 1s should round up via `Math.Ceiling`.
## Related
- #4500 (original issue for `OpenTcpConnectionTimeout`)
- #5873 (fix PR for `OpenTcpConnectionTimeout`)
0 条评论