Skip to content

Cannot use WCT SettingsCard in Uno 5: MissingMethodException #16073

Closed

Description

@lukasf

Current behavior

When adding WCT SettingsControls and placing a SettingsCard in an empty UNO template page, I get an exception on Android (probably on all Non-WinUI heads):

System.MissingMethodException: Method not found: void Microsoft.UI.Xaml.FrameworkElement.remove_IsEnabledChanged(Microsoft.UI.Xaml.DependencyPropertyChangedEventHandler)

I guess this has to do with moving of the IsEnabled property from FrameworkElement to Control in Uno 5.0. But I am using latest Uno 5.1.104 and latest WCT SettingsControl. So I wonder why it still tries to use IsEnabled from FrameworkElement.

The SettingsCard and related controls are critical parts. I cannot move to Uno 5 without these.

Expected behavior

SettingsCard should work without issues.

How to reproduce it (as minimally and precisely as possible)

Add "CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.240109" NuGet package. Add SettingsCard to the MainPage of Uno Template App. Run the Mobile head on Android. See it crash.

UnoAppSettingsCard_2024-03-31 20-11-54Z.zip

Workaround

No response

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

"CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.240109"
"Uno.WinUI" Version="5.1.104"

Affected platforms

Android

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

The same error occurs when using the older SettingsCard from the WCT "Labs".

Activity

  1. added
    difficulty/tbd
    kind/bug
    triage/untriaged
    on Mar 31, 2024
  2. Youssef1313 commented on Apr 1, 2024

    @Youssef1313
    Member

    @lukasf Can you try 8.1.240328-rc?

    Version 8.0.240109 was compiled against Uno 4

  3. lukasf commented on Apr 1, 2024

    @lukasf
    ContributorAuthor

    @Youssef1313: That does not help. I upgraded to 8.1.240328-rc, but the same exception still occurs.

  4. jeromelaban commented on Apr 2, 2024

    @jeromelaban
    Member

    @lukasf this is still being worked on in the RC bits, and is not related to Uno explicitly. You can follow the updates here: CommunityToolkit/Windows#383

  5. michael-hawker commented on Apr 2, 2024

    @michael-hawker

    @lukasf this is still being worked on in the RC bits, and is not related to Uno explicitly. You can follow the updates here: CommunityToolkit/Windows#383

    @jeromelaban why would this not be related to Uno as it's the IsEnabledChanged property in FrameworkElement? This works on WASM for us in https://toolkitlabs.dev (we deployed with the latest bits last week), but if we haven't checked with Android as the OP has called out. If it's something else we need to do in the Toolkit, what would that be?

  6. lukasf commented on Apr 2, 2024

    @lukasf
    ContributorAuthor

    I'd also say that this is clearly related to Uno, since MUX FrameworkElement does not have IsEnabled property and never had. Only Uno 4 had it on FrameworkElement and it was removed and moved to Control (which is the correct place) in Uno 5.

    @jeromelaban It would be great if you can help the WCT team get this right. SettingsCard is crucial in building a convincing settings experience.

  7. michael-hawker commented on Apr 2, 2024

    @michael-hawker

    We do subscribe to IsEnabledChanged for this component here:

    https://github.com/CommunityToolkit/Windows/blob/426b887898c5c8ec7ef5ed29e1b7adec7489e33b/components/SettingsControls/src/SettingsCard/SettingsCard.cs#L70-L79

    But that's available on Control; so maybe it seems within Uno one of the places it was moved was missed with the migration that happened for alignment in Uno 5?

  8. jeromelaban commented on Apr 2, 2024

    @jeromelaban
    Member

    @lukasf I've updated the sample updated you posted, and it's working fine on Android. Note that you may be having issues with the change in the base target for WinAppSDK from 8.1-rc, where you need to change:

    <PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.5.240311000" />

    and use $(DotNetVersion)-windows10.0.22621.0 through out the solution instead of windows10.0.19041.0.

    The most likely explanation is a partial build which continued to use the 8.0 version of the community toolkit, but failed because of the wasdk dependency, and still managed to get deployed.

    Here's the updated sample with versions aligned: 20240402-UnoAppSettingsCard.zip

  9. lukasf commented on Apr 3, 2024

    @lukasf
    ContributorAuthor

    Thank you @jeromelaban, this worked indeed and now SettingsCard runs fine with Uno 5.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty/tbdkind/bugtriage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions