[wasi] TaskToAsyncResult.Begin throws PlatformNotSupportedException
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- csharp
調査の方向性
src/libraries/Common/src/System/Threading/Tasks/TaskToAsyncResult.cs から始め、Begin 内の WASI チェックを調査します。TaskToAsyncResultTests のテスト(InvalidArguments_ThrowExceptions を含む)を実行し、APM ラッパーがシングルスレッド プラットフォームで動作することを確認します。Begin が WASI 上で無条件に失敗しなくなり、AsyncWaitHandle のブロッキング動作が引き続き適切に処理されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C#
- スター
- 18.4k
- フォーク
- 5.7k
- 平均マージ
- 2日 18時間
- マージ済み PR(30日)
- 646
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/runtime のほかの issue
-
[mono] Native memory leak on the first invoke of every open-instance delegate to a virtual methodオープンarea-VM-meta-mono untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dotnet/runtime#136284 · リアクション 6 件 ·
メンテナーはふだん 1 日以内に返信
-
Several MemoryExtensions.LastIndexOfAnyExcept overloads incorrectly document "first occurrence"対応中かも @ehsan-raoufi が 1 日前に担当しました。 オープンarea-System.Memory untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
dotnet/runtime#136282 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
MemoryExtensions.LastIndexOf ignores a custom comparer for bitwise-equatable element types対応中かも @aw0lid が 2 日前に担当しました。 オープンarea-System.Runtime untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
dotnet/runtime#136281 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
area-System.IO.Compression untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
dotnet/runtime#136215 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area-CodeGen-coreclr untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
dotnet/runtime#135849 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
area:jobads-cv BE P3
難易度 1/5 1〜3時間 初心者へのやさしさ 74/100
klasolsson81/jobbliggaren#2240 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
k2-fsa/sherpa-onnx#4100 ·
メンテナーはふだん 2 日以内に返信
-
:watch: Not Triaged
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
unoplatform/uno.check#591 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
weaviate/csharp-client#378 ·