Allow ObservableObject/INotifyPropertyChanged generator to work with interface specified
まだ誰も着手していません。
評価
調査の方向性
明示的に宣言したインターフェイスとともに [ObservableObject] または [INotifyPropertyChanged] を使用して WinUI のケースを再現し、警告 MVVMTK0049/0050 を確認します。まず、生成器がユーザー宣言インターフェイスをどのように処理するかを追跡し、次に生成された実装が引き続き利用可能であること、ならびに抽象型の継承に関する回避策を含めて AOT 警告が解消されていることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Currently, using [ObservableObject]/[INotifyPropertyChanged] generator in WinUI project causes warning MVVMTK0049/0050, since WinRT source generator can't see the implemented interface in MVVMTK source generator.
A workaround for this can be explicitly specify the interfaces in user written part, then they are visible to WInRT source generator:
[INotifyPropertyChanged]
public abstract partial class MyControlBase : UserControl, INotifyPropertyChanged
{
}
However, when the MVVMTK generator sees the interface specification, it will think the interface is implemented by user and remove its generation. If we can force it to provide its generation, then the AOT warning should be addressed.
I also find a workaround by introducing another level of inheritance:
[INotifyPropertyChanged]
public abstract partial class ObservableUserControl : UserControl
{
}
public partial class MyControl : ObservableUserControl, INotifyPropertyChanged
Then WinRT source generator will correctly see interfaces on MyControl, only ObservableUserControl is missing the interface info. Is it safe to ignore the warnings for abstract types?
- 主要言語
- 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
-
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 日以内に返信
-
go 🏃 testing 🧪
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
valkey-io/valkey-glide#7239 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
SubtitleEdit/subtitleedit#15462 ·
メンテナーはふだん 1 日以内に返信