-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] TypeLoadException in MacCatalyst #1195
Comments
I see this similar issue. CommunityToolkit needs updated to the new version of Maui. Is it possible to get a new release that support 7.0.86, please. |
Hi @gktval. 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. |
Just create a brand new Maui Project and add CommunityToolkit in Mac. If you need a reproduction for a new project in Visual Studio, I will put one together... Or use any of the sample ones in this repository |
Here is a link to a brand new project https://github.com/gktval/MauiCommunityToolkitError that the error occurs in. |
Hello @gktval , I downloaded your brand new project where you say the error occurs, however, I was unable to reproduce it locally. Please make sure you are using the follow app versions in macOS:
And that you have installed the following workloads: I ran your demo project without issues. 😃 Regards, |
Thanks for testing and for responding. I just updated to mac OS Ventura 13.4. updated to VS 17.5.6. Still having the same error. A new Maui project works fine. It is only when CommunityToolkit that is referenced in MauiProgram.cs does the error occur. |
we plan a new release tomorrow. Let's see if it works to solve the issue. |
Works now with 5.2. Thank you for updating the package. |
I Still have this issue: System.TypeLoadException: Could not set up parent class, due to: Invalid generic instantiation assembly:/...Microsoft.Maui.dll type:ViewHandler`2 member:(null) I'm using Rider. |
Ditto! This bug has been reintroduced, it appears. |
Perform a Clean Project or Solution and Rebuild corrected the issue for us. VS2022 on Mac .NET MAUI 8 CTK 9.0.2 (rollback, but will updated to see if issue reappears). |
Had this issue after updating from CommunityToolkit.Maui 8.0.1 to 9.0.3. Solution was:
|
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
In a brand new Maui project on MacCatalyst, I am getting a TypeLoadException when the program starts up. The error message says:
"Could not set up parent class, due to: Invalid generic instantiation assembly:/bin/Debug/net7.0-maccatalyst/maccatalyst-x64/SkiaSharpTest.app/Contents/MonoBundle/Microsoft.Maui.dll type:ViewHandler`2 member:(null)"
The source of the error says it is from CommunityToolkit.Maui. here is the stack trace
" at CommunityToolkit.Maui.AppBuilderExtensions.<>c.b__0_0(IMauiHandlersCollection h) in /_/src/CommunityToolkit.Maui/AppBuilderExtensions.shared.cs:line 28\n at Microsoft.Maui.Hosting.HandlerMauiAppBuilderExtensions.HandlerRegistration.AddRegistration(IMauiHandlersCollection builder)\n at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory.CreateHandlerCollection(IEnumerable
1 registrationActions)\n at Microsoft.Maui.Hosting.Internal.MauiHandlersFactory..ctor(IEnumerable
1 registrationActions)\n at Microsoft.Maui.Hosting.HandlerMauiAppBuilderExtensions.<>c.b__1_0(IServiceProvider sp)\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument)\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument)\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)\n at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType)\n at System.Collections.Concurrent.ConcurrentDictionary2[[System.Type, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func
2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type key, Func2 valueFactory)\n at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)\n at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)\n at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)\n at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)\n at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)\n at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IMauiHandlersFactory](IServiceProvider provider)\n at Microsoft.Maui.MauiContext.<.ctor>b__2_0()\n at System.Lazy
1[[Microsoft.Maui.IMauiHandlersFactory, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ViaFactory(LazyThreadSafetyMode mode)\n at System.Lazy1[[Microsoft.Maui.IMauiHandlersFactory, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)\n at System.Lazy
1[[Microsoft.Maui.IMauiHandlersFactory, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].CreateValue()\n at System.Lazy`1[[Microsoft.Maui.IMauiHandlersFactory, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_Value()\n at Microsoft.Maui.MauiContext.get_Handlers()\n at Microsoft.Maui.Platform.ElementExtensions.SetHandler(INativeObject nativeElement, IElement element, IMauiContext context)\n at Microsoft.Maui.Platform.ElementExtensions.SetApplicationHandler(IUIApplicationDelegate platformApplication, IApplication application, IMauiContext context)\n at Microsoft.Maui.MauiUIApplicationDelegate.FinishedLaunching(UIApplication application, NSDictionary launchOptions)\n at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)\n at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)\n at SkiaSharpTest.Program.Main(String[] args) in /Users/gktval/Projects/SkiaSharpTest/Platforms/MacCatalyst/Program.cs:line 13"Any ideas what I can do to resolve this? It seems like this just started happening after updating to Maui 7.0.86.
Expected Behavior
No error
Steps To Reproduce
Create a new Maui Project in Visual Studio. Add CommunityToolkit.Maui nugget. Debug for MacCatalyst.
Link to public reproduction project repository
NA
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: