Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[Bug] CommunityToolkit samples app is broken on Android

Open JRosanowski opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

  • [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

Current Behavior

Exception trying to navigate to any page in the sample app. System.NotSupportedException Message=Unable to activate instance of type Microsoft.Maui.Controls.Platform.Compatibility.ShellItemRenderer from native handle 0x7fda730da0 (key_handle 0x41e2660).

Expected Behavior

No exceptions

Steps To Reproduce

Build the sample app. Debug and try to navigate to any of the pages.

Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui

Environment

- .NET MAUI CommunityToolkit: main branch
- OS: Windows 11
- .NET MAUI: 9.0.102
- Visual Studio 17.12.4

Anything else?

No response

JRosanowski avatar Feb 02 '25 21:02 JRosanowski

It's a known issue fixed in the latest .NET MAUI workload.

  1. Download + install the latest version of .NET: https://dotnet.microsoft.com/en-us/download

  2. After updating to the latest version of .NET, open the a Terminal window and enter the following command:

  • On macOS: sudo dotnet workload install maui;sudo dotnet workload update
  • On Windows: dotnet workload install maui;dotnet workload update

TheCodeTraveler avatar Feb 02 '25 21:02 TheCodeTraveler

Thanks!

JRosanowski avatar Feb 02 '25 21:02 JRosanowski

This appears to be an issue caused by a mismatch between net9.0-android workload and the Microsoft.Maui.Controls NuGet Package.

For now, the workaround is to set options.SetShouldUseStatusBarBehaviorOnAndroidModalPage(false);

.UseMauiCommunityToolkit(static options =>
{
    options.SetShouldEnableSnackbarOnWindows(true);
    options.SetShouldUseStatusBarBehaviorOnAndroidModalPage(false);
})

TheCodeTraveler avatar Feb 06 '25 21:02 TheCodeTraveler

@jfversluis Is this a known issue on the .NET MAUI team? It's nearly identical to the same issue that was resolved in SR3; here's the Discord link to our conversation about it.

TheCodeTraveler avatar Feb 06 '25 21:02 TheCodeTraveler