You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are issues related to the CsWinRT/AOT auto-generated code to proper find the auto-generated code done by CommunityToolKit for [ObservableProperty], which leads to runtime errors since there are missing interfaces.
To Reproduce
Example:
Given a type called FolderMenuItem which has observable property:
[WinRT.BindableCustomProperty]
public partial class FolderMenuItem : ObservableObject
{
[ObservableProperty]
private string name = string.Empty;
public string FolderFriendName { get; set; }
}
Actual result in the WinRTCustomBindableProperties.g.cs is missing the Name property:
FYI @Sergio0694 would this have to do with source generator ordering/dependency? i.e. the CsWinRT generator can't see the output of the MVVM Toolkit generator and therefore doesn't know there's a property?
Of course that'd be resolved by .NET 9 with partial properties and the next iteration of the MVVM Toolkit generator, right?
Yup (see my email reply as well), the right fix for this is just to switch to partial properties in the MVVM Toolkit 🙂
This is not a bug in CsWinRT, the current behavior is by design.
Describe the bug
There are issues related to the CsWinRT/AOT auto-generated code to proper find the auto-generated code done by CommunityToolKit for
[ObservableProperty]
, which leads to runtime errors since there are missing interfaces.To Reproduce
Example:
Given a type called
FolderMenuItem
which has observable property:Actual result in the WinRTCustomBindableProperties.g.cs is missing the
Name
property:Expected behavior
The CsWinRT auto-gen code should see any CTK auto-gen code and proper create the AOT mapping.
As a workaround for now I need to remove
[WinRT.BindableCustomProperty]
and create the interface myself:Version Info
The text was updated successfully, but these errors were encountered: