Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorPicker incompatible with AOT #615

Open
4 of 24 tasks
Marv51 opened this issue Jan 30, 2025 · 1 comment
Open
4 of 24 tasks

ColorPicker incompatible with AOT #615

Marv51 opened this issue Jan 30, 2025 · 1 comment
Labels
nativeaot The dependency on dotnet NativeAOT
Milestone

Comments

@Marv51
Copy link

Marv51 commented Jan 30, 2025

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:

Value="{Binding ElementName=ColorPanelSelector, Path=SelectedItem.Name}">

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.

@michael-hawker michael-hawker added this to the 8.2 milestone Jan 30, 2025
@michael-hawker
Copy link
Member

Related, if not duplicate of #509

@Arlodotexe Arlodotexe moved this to 🆕 New in Toolkit 8.x Feb 6, 2025
@Arlodotexe Arlodotexe added the nativeaot The dependency on dotnet NativeAOT label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nativeaot The dependency on dotnet NativeAOT
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants