1

.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: enter image description here

Visual Studio for Mac version :17.4(build 2406) .net version: .net 7 iPhone 13, iOS 16.3 below are the packages being used: enter image description here

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

Suyash
  • 365
  • 5
  • 18
  • To begin with, you can try to build in `release mode` instead of `debug mode`. If that doesn't work, please help provide more details on this issue like `VS version,` .`NET version`, `iOS device information` and the `nuget packages`. – Alexandar May - MSFT Feb 01 '23 at 06:01
  • You have installed many packages so I can't judge if the issue still exists if add community toolkit package. You can try to create an empty project and add community toolkit package, then determine if the issue still exists. I suspect the issue is caused by the package `Telerik.UI.for.Maui`. You can refer to [.NET MAUI Project - Could not set up parent class, due to: Invalid generic instantiation](https://www.telerik.com/forums/net-maui-project---could-not-set-up-parent-class-due-to-invalid-generic-instantiation). – Alexandar May - MSFT Feb 03 '23 at 00:57
  • @AlexandarMay-MSFT after further investigation of crash logs i found that there is an issue with CommunityToolkt.Maui package. Pasting the crashlogs in question. – Suyash Feb 06 '23 at 05:13
  • If it's related with `CommunityToolkt.Maui package`, you can create an issue at https://github.com/CommunityToolkit/Maui/issues for help. – Alexandar May - MSFT Feb 06 '23 at 07:03

1 Answers1

0

Degrading CommunityToolkt.Maui version from 4.0.0 to 3.1 resolves the issue