`[RelayCommand]` does not work with default/optional arguments as the command parameter
まだ誰も着手していません。
評価
調査の方向性
CommunityToolkit.Mvvm の [RelayCommand] の生成パスとアナライザーのパスから始め、続いてオプションの bool と既定の CancellationToken を持つ、報告されたコマンドを再現します。生成されたコマンドがオプションの引数を処理できるか確認します。コマンドが正しくディスパッチされるか、サポートされていないオプションの引数についてアナライザーが明確なコンパイラーエラーを報告すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
The following command compiles, but causes a runtime error when called.
public override async Task SomeCommandAsync(bool optional = false, CancellationToken cancellationToken = default)
{
}
The same command without the first optional argument does work, i.e. the optional CancellationToken is handled correctly, as far as I can tell.
If it isn't possible to dispatch the command with that default/optional argument, then the analyzer should probably produce a compiler error notifying the user that RelayCommands cannot have optional arguments.
Regression
No response
Steps to reproduce
- Paste the code above into a class inside a project that references the CommunityToolkit
- Run the application
Expected behavior
Either pass in the provided value or the default or generate a compiler error to notify the user that commands cannot have optional arguments.
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
CommunityToolkit.Mvvm 8.4.0
Additional context
No response
Help us help you
No, just wanted to report this
- 主要言語
- C#
- スター
- 3.8k
- フォーク
- 401
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CommunityToolkit/dotnet のほかの issue
-
bug :bug:
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
CommunityToolkit/dotnet#1206 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
CommunityToolkit/dotnet#1186 ·
-
bug :bug:
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
CommunityToolkit/dotnet#648 ·
-
bug :bug:
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
CommunityToolkit/dotnet#1215 ·
-
feature request :mailbox_with_mail:
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
CommunityToolkit/dotnet#1214 ·
CommunityToolkit/dotnet の issue をすべて見る
似ている issue
-
bug P3
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
nightscout/nocturne#1908 ·
メンテナーはふだん 1 日以内に返信
-
bug documentation Needs: Triage :mag:
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
WPF: each page's `Title` overwrites the window title, and returning to a page does not restore itオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
agentic-workflows area/Docs partner/agentic-workflows
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jamesmontemagno/tiny-clips#378 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信