Skip to content

Turning on LLVM compilation causes app crash on start up #74021

@renfred

Description

@renfred

Description

When LLVM is turned on, the app crashes on start up due to:
MonoDroid android.runtime.JavaProxyThrowable: System.ArgumentException: Invalid generic arguments Arg_ParamName_Name, typeArguments

Tested on Android (API version 21), using Visual Studio 2022 v17.3.0 (17.3.32804.467 - August 9, 2022).

Reproduceable by creating a new MAUI project in Visual Studio.

Steps to Reproduce

  1. Create a new MAUI project
  2. Go to Project Properties and enable LLVM on Android Release build (under Android > Options)
  3. Deploy and run the project to an Android emulator or a physical device.

Version with bug

6.0.486 (current)

Last version that worked well

6.0.312

Affected platforms

Android

Affected platform versions

Android API 21

Did you find any workaround?

No

Relevant log output

Time	Device Name	Type	PID	Tag	Message
08-16 00:02:15.188	nexus_one_-_api_21	Info	20428	MonoDroid	android.runtime.JavaProxyThrowable: System.ArgumentException: Invalid generic arguments Arg_ParamName_Name, typeArguments
   at System.RuntimeType.CreateInstanceForAnotherGenericParameter(Type , RuntimeType )
   at System.Collections.Generic.EqualityComparer`1[[Microsoft.Maui.WeakEventManager.Subscription, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].CreateComparer()
   at System.Array.IndexOf[Subscription](Subscription[] , Subscription , Int32 , Int32 )
   at System.Collections.Generic.List`1[[Microsoft.Maui.WeakEventManager.Subscription, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].IndexOf(Subscription )
   at System.Collections.Generic.List`1[[Microsoft.Maui.WeakEventManager.Subscription, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Remove(Subscription )
   at Microsoft.Maui.WeakEventManager.RemoveEventHandler(String eventName, Object handlerTarget, MemberInfo methodInfo)
   at Microsoft.Maui.WeakEventManager.RemoveEventHandler[AppThemeChangedEventArgs](EventHandler`1 handler, String eventName)
   at Microsoft.Maui.Controls.Application.remove_RequestedThemeChanged(EventHandler`1 value)
   at Microsoft.Maui.Controls.AppThemeBinding.DetachEvents()
   at Microsoft.Maui.Controls.AppThemeBinding.AttachEvents()
   at Microsoft.Maui.Controls.AppThemeBinding.Apply(Object context, BindableObject bindObj, BindableProperty targetProperty, Boolean fromBindingContextChanged)
   at Microsoft.Maui.Controls.BindableObject.SetBinding(BindableProperty targetProperty, BindingBase binding, Boolean fromStyle)
   at Microsoft.Maui.Controls.Shell..ctor()
   at MauiApp1.App..ctor()
   at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object , Object[] , Boolean )
   at System.Reflection.RuntimeConstructorInfo.DoInvoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags , Binder , Object[] , CultureInfo )
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite , RuntimeResolverContext )
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite , RuntimeResolverContext )
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite , RuntimeResolverContext )
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite , RuntimeResolverContext )
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type )
   at System.Collections.Concurrent.ConcurrentDictionary`2[[System.Type, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type , Func`2 )
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type , ServiceProviderEngineScope )
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type )
   at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
   at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider , Type )
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IApplication](IServiceProvider )
   at Microsoft.Maui.MauiApplication.OnCreate()
   at Android.App.Application.n_OnCreate(IntPtr , IntPtr )
   at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr )
	at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method)
	at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
	at android.app.ActivityThread.access$1500(ActivityThread.java:144)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5221)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
  --- End of managed Android.Runtime.JavaProxyThrowable stack trace ---

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions