Reputation: 415
.net MAUI Project based on .net version 7 getting crashed while I am trying to deploy it on device. Below is the exception I am getting:
Visual Studio for Mac version :17.4(build 2406)
.net version: .net 7
iPhone 13, iOS 16.3
below are the packages being used:
Crashlogs: Unhandled Exception: System.TypeLoadException: Could not set up parent class, due to: Invalid generic instantiation assembly:/private/var/containers/Bundle/Application/8849B149-36C8-4750-86DD-2AAC2A958F3D//Microsoft.Maui.dll type:ViewHandler2 member:(null) at CommunityToolkit.Maui.AppBuilderExtensions.<>c.b__0_0(IMauiHandlersCollection h) in /_/src/CommunityToolkit.Maui/AppBuilderExtensions.shared.cs:line 28 at Microsoft.Maui.Hosting.HandlerMauiAppBuilderExtensions.HandlerRegistration.AddRegistration(IMauiHandlersCollection builder) at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.CreateHandlerCollection(IEnumerable1 registrationActions) at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory..ctor(IEnumerable`1 registrationActions) at Microsoft.Maui.Hosting.HandlerMauiAppBuilderExtensions.<>c.b__1_0(IServiceProvider sp) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.<…>
Upvotes: 5
Views: 2843
Reputation: 301
In my case it was caused due to outdated MAUI workloads that was installed on the Mac. See the issue thread on Github for more info. Running the following command updated the workloads and resolved the issue for me (Ended up having to update my Mac and then update XCode to 15.4 as well):
sudo dotnet workload install android ios maui
Upvotes: 5
Reputation: 31
Degrading CommunityToolkt.Maui version from 4.0.0 to 3.1 resolves the issue
Upvotes: 3