[wasi] TaskToAsyncResult.Begin throws PlatformNotSupportedException
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp
- Lĩnh vực
- backend-api-design, operating-systems
Hướng nghiên cứu
Bắt đầu tại src/libraries/Common/src/System/Threading/Tasks/TaskToAsyncResult.cs và kiểm tra điều kiện WASI trong Begin. Chạy các bài kiểm thử TaskToAsyncResultTests, bao gồm InvalidArguments_ThrowExceptions, để xác nhận wrapper APM hoạt động trên các nền tảng đơn luồng. Hoàn tất khi Begin không còn luôn thất bại trên WASI và hành vi chặn của AsyncWaitHandle vẫn được xử lý phù hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
System.Threading.Tasks.TaskToAsyncResult.Begin unconditionally throws PlatformNotSupportedException on WASI:
// src/libraries/Common/src/System/Threading/Tasks/TaskToAsyncResult.cs
public static IAsyncResult Begin(Task task, AsyncCallback? callback, object? state)
{
#if NET
if (OperatingSystem.IsWasi()) throw new PlatformNotSupportedException(); // TODO remove with https://github.com/dotnet/runtime/pull/107185
The TODO points at https://github.com/dotnet/runtime/pull/107185, a draft that added UnsupportedOSPlatform annotations for WASI; it was closed without merging. So the check remains and nothing tracks it.
Begin wraps a Task in an IAsyncResult and schedules the callback as a continuation. That does not need extra threads, although code that blocks on the returned AsyncWaitHandle would.
The APM helpers throughout the libraries go through it, so on WASI every Begin*/End* pattern built on TaskToAsyncResult fails, as does Task.Factory.FromAsync over such a pair. In the CoreCLR WASI library test runs on https://github.com/dotnet/runtime/pull/134813, all six TaskToAsyncResultTests tests that run on a single-threaded platform fail this way. That includes InvalidArguments_ThrowExceptions, which expects ArgumentNullException.
Proposed fix
Remove the WASI check so Begin works as on browser. If blocking on AsyncWaitHandle must stay unsupported, keep that limitation where the wait happens. Otherwise, annotate the API as unsupported on WASI instead of throwing unconditionally.
[!NOTE]
This issue was drafted with the help of GitHub Copilot.
- Ngôn ngữ chính
- C#
- Star
- 18.4k
- Fork
- 5.8k
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 579
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/runtime
-
Incorrect loop bound in SizeOptIListSelectIterator.ToListCó thể đã có người làm @equmagg đã nhận hôm nay. Đang mởarea-System.Collections untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
dotnet/runtime#137126 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DbTransaction.SupportsSavepoints docs say Release/ReleaseAsync are expected to throw, but they are no-ops by designCó thể đã có người làm @alaricd đã nhận 1 ngày trước. Đang mởarea-System.Transactions untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
dotnet/runtime#137040 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
FileSystemGlobbing: Matcher throws ArgumentOutOfRangeException when the rootDir is the same value as the fileCó thể đã có người làm @makazeu đã nhận 1 ngày trước. Đang mởarea-Extensions-FileSystem
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dotnet/runtime#136989 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Configuration binder source generator emits unqualified List<T> when binding arrays without implicit usingsCó thể đã có người làm @makazeu đã nhận 1 ngày trước. Đang mởarea-Extensions-Configuration bug source-generator
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dotnet/runtime#136972 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[wasi] .NET 10: WasmEnableSIMD with AOT fails because WasiApp.targets has -msimd128 commented outĐang mởarea-Build-mono untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của dotnet/runtime
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Facepunch/sbox-public#12305 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
分享 JVC DVD+RW 4.7G (铼德代工) 实测标定预设Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
JiaFeiMiao-K-Cat/DiscImageStudio#205 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
flyingpie/windows-terminal-quake#419 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Show the per-model weekly limitĐang mởenhancement help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
a-corriger documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 83/100
christian-raj/S-Aloha#272 ·