fix(network): 临时禁用 HTTP/3 以缓解 dotnet/runtime#114128#3243
Merged
Conversation
Contributor
评审者指南(在小型 PR 上折叠)评审者指南此 PR 暂时停止强制使用 HTTP/3 进行图片下载请求,以避免在 .NET 8 中出现无法捕获的 QuicException 问题;在项目升级到 .NET 10 之前,允许进行 HTTP 版本协商/使用 HTTP/2。 未强制 HTTP/3 情况下的图片下载时序图sequenceDiagram
participant MyImage
participant HttpRequest
participant Server
MyImage->>HttpRequest: Create(url)
activate HttpRequest
HttpRequest-->>MyImage: HttpRequestInstance
deactivate HttpRequest
MyImage->>HttpRequest: SendAsync(addMetedata: false)
activate HttpRequest
rect rgb(230,230,230)
Note over HttpRequest: HTTP version negotiated by runtime
end
HttpRequest->>Server: HTTP request (HTTP2_or_HTTP3)
Server-->>HttpRequest: HTTP response
deactivate HttpRequest
MyImage->>MyImage: EnsureSuccessStatusCode()
MyImage->>MyImage: WriteTo FileStream(tempDownloadingPath)
文件级变更
针对关联问题的评估
提示与命令与 Sourcery 交互
自定义你的使用体验前往你的 控制面板 以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR temporarily disables forcing HTTP/3 for image download requests to avoid an uncatchable QuicException issue in .NET 8, allowing HTTP version negotiation/HTTP/2 instead until the project upgrades to .NET 10. Sequence diagram for image download without forced HTTP3sequenceDiagram
participant MyImage
participant HttpRequest
participant Server
MyImage->>HttpRequest: Create(url)
activate HttpRequest
HttpRequest-->>MyImage: HttpRequestInstance
deactivate HttpRequest
MyImage->>HttpRequest: SendAsync(addMetedata: false)
activate HttpRequest
rect rgb(230,230,230)
Note over HttpRequest: HTTP version negotiated by runtime
end
HttpRequest->>Server: HTTP request (HTTP2_or_HTTP3)
Server-->>HttpRequest: HTTP response
deactivate HttpRequest
MyImage->>MyImage: EnsureSuccessStatusCode()
MyImage->>MyImage: WriteTo FileStream(tempDownloadingPath)
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - 我在这里给出了一些高层次的反馈:
- 建议将 HTTP 版本的配置进行集中管理(例如通过共享的 HttpRequest 工厂或配置对象),这样在禁用 HTTP/3 时就不需要修改每一个调用点,并且在升级到 .NET 10 后也可以轻松恢复。
- 鉴于这只是一个临时缓解措施,建议在移除
WithHttpVersionOption(HttpVersion.Version30)的位置附近加上一条简洁的代码注释,说明 .NET 8 运行时的相关 bug,以及计划在升级到 .NET 10 后重新评估这一改动,以方便后续维护者理解。
给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- Consider centralizing the HTTP version configuration (e.g., via a shared HttpRequest factory or settings object) so that disabling HTTP/3 doesn’t require touching each individual call site and can be easily reverted when upgrading to .NET 10.
- Given this is a temporary mitigation, it might be helpful to add a concise code comment near the removed `WithHttpVersionOption(HttpVersion.Version30)` describing the .NET 8 runtime bug and the intent to revisit this after upgrading to .NET 10, to aid future maintainers.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的 Review。
Original comment in English
Hey - I've left some high level feedback:
- Consider centralizing the HTTP version configuration (e.g., via a shared HttpRequest factory or settings object) so that disabling HTTP/3 doesn’t require touching each individual call site and can be easily reverted when upgrading to .NET 10.
- Given this is a temporary mitigation, it might be helpful to add a concise code comment near the removed
WithHttpVersionOption(HttpVersion.Version30)describing the .NET 8 runtime bug and the intent to revisit this after upgrading to .NET 10, to aid future maintainers.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider centralizing the HTTP version configuration (e.g., via a shared HttpRequest factory or settings object) so that disabling HTTP/3 doesn’t require touching each individual call site and can be easily reverted when upgrading to .NET 10.
- Given this is a temporary mitigation, it might be helpful to add a concise code comment near the removed `WithHttpVersionOption(HttpVersion.Version30)` describing the .NET 8 runtime bug and the intent to revisit this after upgrading to .NET 10, to aid future maintainers.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
MoYuan-CN
approved these changes
Jun 23, 2026
LuLu-ling
approved these changes
Jun 24, 2026
RyogiMutsuki
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This resolves #3226.
根据本人探索,此问题是由 dotnet/runtime#114128 引起的。.NET 的 HTTP/3 实现在 stream abort 时会把
QuicException挂到内部 Task,无法从请求调用点 catch,导致这个异常没有经过任何 try catch,而是直接走到了TaskScheduler.UnobservedTaskException。此问题在 .NET 10 被修复,主项目版本却仍为 .NET 8,因此,此问题应当在升级至 .NET 10 之后解决。
综上所述,解决此问题只有两个方法:
由于仍有一部分用户的系统版本较低,因此升级至 .NET 10 还需要一定时间。所以此问题的最佳修复方案是禁用强制 HTTP/3,在有条件升级至 .NET 10 之后回退此更改
Summary by Sourcery
Bug Fixes:
Original summary in English
Summary by Sourcery
Bug Fixes: