Description
Describe the bug
I'm trying to enable NativeAOT compilation for my app.
I am using Community Toolkit 8.2 Preview 2 (with CsWinRT 2.2) in WinAppSDK/WinUI 1.6.4 on .NET 9.0.1
With AOT enabled, when I click on a ColorPickerButton, which should show a ColorPicker my app crashes with a NotSupportedException. It works perfectly without AOT.
'ICustomProperty support used by XAML binding for type 'CommunityToolkit.WinUI.Controls.SegmentedItem' (property 'Name') requires the type to marked with 'WinRT.GeneratedBindableCustomPropertyAttribute'. If this is a built-in type or a type that can't be marked, a wrapper type should be used around it that is marked to enable this support.'
Steps to reproduce
My colorpickerbutton looks like this:
<!-- xmlns:controls="using:CommunityToolkit.WinUI.Controls" --->
<controls:ColorPickerButton Background="#818181"
HorizontalAlignment="Stretch"
SelectedColor="{x:Bind myObject.Color, Mode=TwoWay}">
</controls:ColorPickerButton>
Expected behavior
No exception
Screenshots
Can provide if required.
Code Platform
- UWP
- WinAppSDK / WinUI 3
- Web Assembly (WASM)
- Android
- iOS
- MacOS
- Linux / GTK
Windows Build Number
- Windows 10 1809 (Build 17763)
- Windows 10 1903 (Build 18362)
- Windows 10 1909 (Build 18363)
- Windows 10 2004 (Build 19041)
- Windows 10 20H2 (Build 19042)
- Windows 10 21H1 (Build 19043)
- Windows 10 21H2 (Build 19044)
- Windows 10 22H2 (Build 19045)
- Windows 11 21H2 (Build 22000)
- Other (specify)
Other Windows Build number
Windows 11 24H2 (Build 26100)
App minimum and target SDK version
- Windows 10, version 1809 (Build 17763)
- Windows 10, version 1903 (Build 18362)
- Windows 10, version 1909 (Build 18363)
- Windows 10, version 2004 (Build 19041)
- Windows 10, version 2104 (Build 20348)
- Windows 11, version 22H2 (Build 22000)
- Other (specify)
Other SDK version
Windows 11, version Build 22621
Visual Studio Version
2022
Visual Studio Build Number
Version 17.12.4
Device form factor
Desktop
Additional context
I believe this Binding in ColorPicker might be at fault:
And I can indeed, like the exception says, not find any GeneratedBindableCustomProperty attribute on SegmentedItem.
Help us help you
No, I'm unable to contribute a solution.
Sub-issues
Metadata
Metadata
Assignees
Type
Projects
Status