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

Cannot use WCT SettingsCard in Uno 5: MissingMethodException #16073

Closed
lukasf opened this issue Mar 31, 2024 · 8 comments
Closed

Cannot use WCT SettingsCard in Uno 5: MissingMethodException #16073

lukasf opened this issue Mar 31, 2024 · 8 comments
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@lukasf
Copy link

lukasf commented Mar 31, 2024

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".

@lukasf lukasf added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Mar 31, 2024
@Youssef1313
Copy link
Member

@lukasf Can you try 8.1.240328-rc?

Version 8.0.240109 was compiled against Uno 4

@lukasf
Copy link
Author

lukasf commented Apr 1, 2024

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

@jeromelaban
Copy link
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

@michael-hawker
Copy link

michael-hawker commented Apr 2, 2024

@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?

@lukasf
Copy link
Author

lukasf commented Apr 2, 2024

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.

@michael-hawker
Copy link

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?

@jeromelaban jeromelaban reopened this Apr 2, 2024
@jeromelaban
Copy link
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

@lukasf
Copy link
Author

lukasf commented Apr 3, 2024

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
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

4 participants