Allow ObservableObject/INotifyPropertyChanged generator to work with interface specified
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Tái hiện trường hợp WinUI bằng cách sử dụng [ObservableObject] hoặc [INotifyPropertyChanged] với một interface được khai báo rõ ràng và quan sát các cảnh báo MVVMTK0049/0050. Bắt đầu bằng cách theo dõi cách generator xử lý các interface do người dùng khai báo, sau đó xác minh rằng implementation được sinh vẫn khả dụng và các cảnh báo AOT đã được giải quyết, bao gồm cả workaround cho việc kế thừa kiểu trừu tượng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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?
- Ngôn ngữ chính
- C#
- Star
- 3.8k
- Fork
- 401
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- 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 CommunityToolkit/dotnet
-
bug :bug:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
CommunityToolkit/dotnet#1206 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
CommunityToolkit/dotnet#1186 ·
-
bug :bug:
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
CommunityToolkit/dotnet#648 ·
-
bug :bug:
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
CommunityToolkit/dotnet#1215 ·
-
feature request :mailbox_with_mail:
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
CommunityToolkit/dotnet#1214 ·
Tất cả issue của CommunityToolkit/dotnet
Issue tương tự
-
copilot documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 2 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
elsa-workflows/elsa-foundation#2290 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/semantic-kernel#14522 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
area-integrations needs-area-label triage:bot-seen triage:needs-human
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/aspire#20652 · 1 bình luận ·
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 68/100
agoda-com/Shouldly.FromAssert#40 ·
Maintainer thường phản hồi trong vòng 1 ngày