I've got it working:
Community Toolkit should be on latest stable version.
.net SDK should be on latest stable version.
Visual Studio should be on latest version.
Once all updated, rebuild your maui project, and run.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a MAUI app that works on windows and android.
But when I plug in an iphone and start debugging, the app crashes after a few seconds of the splash screen.
Debug output:
Thread started: #8
Thread started: #9
Thread started: #10
[0:] An error occurred: 'Could not set up parent class, due to: Invalid generic instantiation assembly:/private/var/mobile/Containers/Data/Application/E6380576-528A-44C3-826B-D8902061AFF5/Documents/SmartSurv.content/Microsoft.Maui.dll type:ViewHandler`2 member:(null)'. Callstack: ' 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)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
at System.Collections.Concurrent.ConcurrentDictionary2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceIdentifier, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.Extensions.DependencyInjection.ServiceProvider.ServiceAccessor, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].GetOrAdd(ServiceIdentifier key, Func
2 valueFactory)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredServiceIMauiHandlersFactory
at Microsoft.Maui.MauiContext.<.ctor>b__2_0()
at System.Lazy`1[[Microsoft.Maui.IMauiHandlersFactory, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1[[Microsoft.Maui.IMauiHandlersFactory, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1[[Microsoft.Maui.IMauiHandlersFactory, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].CreateValue()
at System.Lazy`1[[Microsoft.Maui.IMauiHandlersFactory, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_Value()
at Microsoft.Maui.MauiContext.get_Handlers()
at Microsoft.Maui.Platform.ElementExtensions.SetHandler(INativeObject nativeElement, IElement element, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.SetApplicationHandler(IUIApplicationDelegate platformApplication, IApplication application, IMauiContext context)
at Microsoft.Maui.MauiUIApplicationDelegate.FinishedLaunching(UIApplication application, NSDictionary launchOptions)
at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 58
at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
at SmartSurv.Program.Main(String[] args) in C:\Users\Daniel\source\repos\smartsurv\SmartSurv\Platforms\iOS\Program.cs:line 13
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)'
2024-09-13 17:20:30.033 Xamarin.PreBuilt.iOS[669:26650] Could not resolve assembly System.Private.DataContractSerialization.resources, Version=8.0.0.0, Culture=en, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/E6380576-528A-44C3-826B-D8902061AFF5/Documents/SmartSurv.content/System.Private.DataContractSerialization.resources.dll' or one of its dependencies.
2024-09-13 17:20:29.993 Xamarin.PreBuilt.iOS[669:26650] Could not resolve assembly Telerik.Maui.Core.resources, Version=7.1.0.0, Culture=en-GB, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/E6380576-528A-44C3-826B-D8902061AFF5/Documents/SmartSurv.content/Telerik.Maui.Core.resources.dll' or one of its dependencies.
2024-09-13 17:20:29.995 Xamarin.PreBuilt.iOS[669:26650] Could not resolve assembly Telerik.Maui.Core.resources, Version=7.1.0.0, Culture=en, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/E6380576-528A-44C3-826B-D8902061AFF5/Documents/SmartSurv.content/Telerik.Maui.Core.resources.dll' or one of its dependencies.
2024-09-13 17:20:30.031 Xamarin.PreBuilt.iOS[669:26650] Could not resolve assembly System.Private.DataContractSerialization.resources, Version=8.0.0.0, Culture=en-GB, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/E6380576-528A-44C3-826B-D8902061AFF5/Documents/SmartSurv.content/System.Private.DataContractSerialization.resources.dll' or one of its dependencies.
The app has been terminated.
I've got it working:
Community Toolkit should be on latest stable version.
.net SDK should be on latest stable version.
Visual Studio should be on latest version.
Once all updated, rebuild your maui project, and run.