CommunityToolkit / Maui

The .NET MAUI Community Toolkit is a community-created library that contains .NET MAUI Extensions, Advanced UI/UX Controls, and Behaviors to help make your life as a .NET MAUI developer easier
https://learn.microsoft.com/dotnet/communitytoolkit/maui
MIT License
2.22k stars 383 forks source link

[BUG] TouchEffect does not work on iOS when app is built in Release #2235

Open velocitysystems opened 1 day ago

velocitysystems commented 1 day ago

Is there an existing issue for this?

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

Current Behavior

TouchEffect does not work on iOS when app is built in Release. This is a regression in 9.1.0 and possibly due to AOT improvements.

Expected Behavior

TouchEffect should work and fire events/execute commands when attached to a view.

Steps To Reproduce

  1. Create a new blank MAUI project
  2. Add a TouchEffect to any control
  3. Build the app in Release configuration

Link to public reproduction project repository

AotSample.zip

Environment

- .NET MAUI CommunityToolkit: 9.1.0
- OS: iOS 17.5
- .NET MAUI: 8.0.91 SR9.1 (latest)

Anything else?

Works in 9.0.3. Android works in both Debug and Release.

dotnet-policy-service[bot] commented 1 day ago

Hi @velocitysystems. We have added the "needs reproduction" label to this issue, which indicates that we cannot take further action. This issue will be closed automatically in 5 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

velocitysystems commented 20 hours ago

@brminnick Added reproduction project. I also get a persistent startup crash when debugging on iOS (Android is unaffected):

System.TypeLoadException: Could not set up parent class, due to: Invalid generic instantiation assembly:/Users/dev/Library/Developer/CoreSimulator/Devices/F766998B-9560-4192-90C8-DEC128E8E6D9/data/Containers/Bundle/Application/C4DE1219-9F4A-4D31-9354-A887F27BD4BF/AotSample.app/Microsoft.Maui.dll type:ViewHandler`2 member:(null)
   at CommunityToolkit.Maui.AppBuilderExtensions.<>c.<UseMauiCommunityToolkit>b__0_0(IMauiHandlersCollection h)
   at Microsoft.Maui.Hosting.HandlerMauiAppBuilderExtensions.HandlerRegistration.AddRegistration(IMauiHandlersCollection builder)
   at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.CreateHandlerCollection(IEnumerable`1 registrationActions)
   at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory..ctor(IEnumerable`1 registrationActions)
   at Microsoft.Maui.Hosting.HandlerMauiAppBuilderExtensions.<>c.<ConfigureMauiHandlers>b__1_0(IServiceProvider sp)

I've tried the following steps mentioned here with no luck:

Rolling back to 9.0.3 everything works fine.