Generated HTTP client proxy drops fractional seconds in DateTimeOffset query parameters
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Bit.SourceGenerators 10.7.0 emits an HTTP client proxy that drops fractional seconds when a nullable DateTimeOffset is expanded into a query parameter. A UTC cursor of 2026-11-30T15:50:41.1234567+00:00 becomes 11/30/2026 15:50:41 +00:00 in the decoded query. The server binds a valid timestamp that is 1,234,567 ticks earlier than the original.
Expected Behavior
The query parameter should round-trip the timestamp, including its fractional seconds and UTC offset. Invariant O formatting is one way to preserve both.
Steps To Reproduce
Add this controller contract to a Bit Boilerplate shared project and resolve it through the generated typed HTTP client registration.
[Route("api/v1/[controller]/[action]/")]
public interface ICursorController : IAppController
{
[HttpGet("{?beforeAt}")]
Task Get(DateTimeOffset? beforeAt, CancellationToken cancellationToken);
}
Call Get with the cursor below and capture the outgoing request with a recording HttpMessageHandler. Decode the beforeAt value and parse it back to DateTimeOffset. Compare the result to the original with EqualsExact.
var cursor = new DateTimeOffset(2026, 11, 30, 15, 50, 41, TimeSpan.Zero)
.AddTicks(1_234_567);
await controller.Get(cursor, CancellationToken.None);
The default formatting and round-trip formatting can also be compared directly.
var actual = ((IFormattable)cursor).ToString(null, CultureInfo.InvariantCulture);
var expected = cursor.ToString("O", CultureInfo.InvariantCulture);
Exceptions (if any)
No exception. The request succeeds with the wrong timestamp.
.NET Version
11.0.100
Anything else?
- Observed with
Bit.SourceGenerators10.7.0on Windows in a real HTTP integration test against a disposable SQL Server database. - In the test, 52 activity records shared one timestamp and were paginated with a timestamp plus a tie-breaker. The first page returned 25 records. The second returned 0 instead of 25 because the cursor came back truncated to the second, before all records at the original timestamp.
- With a
string?query parameter carrying the explicitly formatted ISO 8601 UTC timestamp, the same test passed with page sizes25 / 25 / 2and all 52 distinct records. - The generated
FormatValue<T>takes theIFormattable.ToString(null, InvariantCulture)path for this value. Source for the tested package.
- 主要语言
- C#
- 星标
- 1.4k
- 派生
- 264
- 平均合并
- 5 小时 45 分钟
- 30 天内合并 PR
- 494
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bitfoundation/bitplatform 的其他 Issue
-
Project dependencies are outdated可能已有人在做 @yasmoradi 今天认领。 未关闭dependencies
难度 1/5 1-3 小时 新手友好度 68/100
bitfoundation/bitplatform#15562 ·
维护者通常 1 天内回复
-
EveryListedPageBecomesInteractiveWithoutAnError sometimes fails on WebKit when it leaves the PDF viewer可能已有人在做 @msynk 今天认领。 未关闭
bitfoundation/bitplatform#15565 · 已指派 1 人 ·
维护者通常 1 天内回复
-
BitReducedMotionBrowserTests measure an image fade that has already ended可能已有人在做 @msynk 今天认领。 未关闭
bitfoundation/bitplatform#15564 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
BitDataGrid未关闭
难度 2/5 1-3 小时 新手友好度 48/100
bitfoundation/bitplatform#15548 · 8 条评论 ·
维护者通常 1 天内回复
-
Add the Bit.BbScanner.BlazorUI package with BlazorUI scanner controls可能已有人在做 @msynk 于 1 天前认领。 未关闭area / bbscanner area / BlazorUI
bitfoundation/bitplatform#15547 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 bitfoundation/bitplatform 的全部 Issue
相似的 Issue
-
State: Needs Discussion
难度 2/5 1-3 小时 新手友好度 76/100
getsentry/sentry-dotnet#6071 · 1 条评论 ·
维护者通常 1 天内回复
-
:watch: Not Triaged dotnet-target-version
难度 1/5 1 小时以内 新手友好度 84/100
dotnet/docs-desktop#2313 ·
维护者通常 4 天内回复
-
dotnet-target-version
难度 2/5 1-3 小时 新手友好度 77/100
-
:watch: Not Triaged dotnet-target-version
难度 1/5 1 小时以内 新手友好度 80/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
IntelliTect/Coalesce#794 · 1 条评论 ·