Open
Description
Describe the bug
Hi, after updating the nuGet packet i get the folling error when starting the application:
2024-08-31 09:52:53.920138+0200 <APPNAME>[54180:1568153] System.TypeLoadException: Could not set up parent class, due to: Invalid generic instantiation assembly:/Users/<USERNAME>/Library/Developer/CoreSimulator/Devices/A138E2DE-3DF0-4BC2-8889-BA1CBC699ED6/data/Containers/Bundle/Application/79E58D76-D3A6-4060-B4FA-4B109B01FB74/<APPNAME>.app/Microsoft.Maui.dll type:ViewHandler`2 member:(null)
at CommunityToolkit.Maui.AppBuilderExtensions.<>c.<UseMauiCommunityToolkit>b__0_0(IMauiHandlersCollection h)
2024-08-31 09:52:53.920397+0200 <APPNAME>[54180:1568153] at Microsoft.Maui.Hosting.HandlerMauiAppBuilderExtensions.HandlerRegistration.AddRegistration(IMauiHandlersCollection builder)
at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.CreateHandlerCollection(IEnumerable`1 registrationActions)
2024-08-31 09:52:53.920607+0200 <APPNAME>[54180:1568153] at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory..ctor(IEnumerable`1 registrationActions)
at Microsoft.Maui.Hosting.HandlerMauiAppBuilderExtensions.<>c.<ConfigureMauiHandlers>b__1_0(IServiceProvider sp)
2024-08-31 09:52:53.920812+0200 <APPNAME>[54180:1568153] at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
2024-08-31 09:52:53.921040+0200 <APPNAME>[54180:1568153] 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)
2024-08-31 09:52:53.921275+0200 <APPNAME>[54180:1568153] 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)
2024-08-31 09:52:53.921452+0200 <APPNAME>[54180:1568153] at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
2024-08-31 09:52:53.921692+0200 <APPNAME>[54180:1568153] at System.Collections.Concurrent.ConcurrentDictionary`2[[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)
2024-08-31 09:52:53.923808+0200 <APPNAME>[54180:1568153] at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
2024-08-31 09:52:53.928044+0200 <APPNAME>[54180:1568153] at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
2024-08-31 09:52:53.930845+0200 <APPNAME>[54180:1568153] at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IMauiHandlersFactory](IServiceProvider provider)
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)
2024-08-31 09:52:53.932735+0200 <APPNAME>[54180:1568153] at System.Lazy`1[[Microsoft.Maui.IMauiHandlersFactory, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
2024-08-31 09:52:53.934098+0200 <APPNAME>[54180:1568153] 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()
2024-08-31 09:52:53.935420+0200 <APPNAME>[54180:1568153] at Microsoft.Maui.MauiContext.get_Handlers()
at Microsoft.Maui.Platform.ElementExtensions.SetHandler(INativeObject nativeElement, IElement element, IMauiContext context)
2024-08-31 09:52:53.936655+0200 <APPNAME>[54180:1568153] at Microsoft.Maui.Platform.ElementExtensions.SetApplicationHandler(IUIApplicationDelegate platformApplication, IApplication application, IMauiContext context)
at Microsoft.Maui.MauiUIApplicationDelegate.FinishedLaunching(UIApplication application, NSDictionary launchOptions)
2024-08-31 09:52:53.937739+0200 <APPNAME>[54180:1568153] at ActiveID.AppDelegate.FinishedLaunching(UIApplication app, NSDictionary options) in <PATH_TO_APPLICATION>/<APPNAME>/<APPNAME>/Platforms/iOS/AppDelegate.cs:line 27
2024-08-31 09:52:53.938361+0200 <APPNAME>[54180:1568153] 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
2024-08-31 09:52:53.938942+0200 <APPNAME>[54180:1568153] 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 ActiveID.Program.Main(String[] args) in <PATH_TO_APPLICATION>/<APPNAME>/<APPNAME>/Platforms/iOS/Program.cs:line 14
Stopping iOS process...
iOS Process was stopped.
This occurs only on iOS, for release builds in testflight and debug builds, but not for any of my Android builds.
The way i initialize the toolkit:
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp<App>()
.UseSkiaSharp()
.RegisterFirebaseServices()
.UseBarcodeReader()
.UseMauiCommunityToolkit();
return builder.Build();
}
The way i register my WeakReferenceMessenger is:
/// <summary>
/// Subscribe listeners that listen to device specific events
/// </summary>
protected void SubscribeListeners()
{
WeakReferenceMessenger.Default.Register<PushNotificationReceived>(this, (r, notificationReceived) =>
{
DisplayAlertAsync(r, notificationReceived.Value);
});
}
Regression
It worked in version 8.2.0
Steps to reproduce
Not sure, i had 8.2.0 Of Mvvm installed. I updated the Toolkit and the .Mvvm package to the latest versions, and now the application wont start.
If you want to know specifics, let me know.
Expected behavior
That the iOS application does not crash after showing the splash screen.
Screenshots
No response
IDE and version
Other
IDE version
VS For mac and Visual Studio Code on mac.
Nuget packages
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
8.3.0
Additional context
No response
Help us help you
Yes, but only if others can assist