dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.04k stars 1.73k forks source link

[Android] Crash when running release mode #23342

Closed gabriel-kozma closed 2 months ago

gabriel-kozma commented 3 months ago

Description

My app is crashing when I run the app built with release

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.61 SR6.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

06-28 12:44:24.626 28233 28233 D monodroid-assembly: monodroid_dlopen: hash for name 'liblog' is 0xce23a84560fcc512
06-28 12:44:24.626 28233 28233 D monodroid-assembly: monodroid_dlopen: hash match not found, DSO name is '<unknown>'
06-28 12:44:24.626 28233 28233 I monodroid-assembly: Trying to load shared library '/data/app/~~Z_0gGPc6lrFLUMmJ8-Amrw==/com.gabrielmackoz.MKFlasher-6N-Lx-w6GpEkEmyKHWhb4A==/lib/arm64/liblog'
06-28 12:44:24.626 28233 28233 I monodroid-assembly: Shared library '/data/app/~~Z_0gGPc6lrFLUMmJ8-Amrw==/com.gabrielmackoz.MKFlasher-6N-Lx-w6GpEkEmyKHWhb4A==/lib/arm64/liblog' not found
06-28 12:44:24.626 28233 28233 I monodroid-assembly: Trying to load shared library 'liblog'
06-28 12:44:24.626 28233 28233 I monodroid-assembly: Shared library 'liblog' not found
06-28 12:44:24.626 28233 28233 W monodroid-assembly: Shared library 'liblog' not loaded, p/invoke '__android_log_print' may fail
06-28 12:44:24.626 28233 28233 D Mono    : DllImport attempting to load: 'liblog'.
06-28 12:44:24.626 28233 28233 D Mono    : AOT: FOUND method System.Runtime.InteropServices.NativeLibrary:MonoLoadLibraryCallbackStub (string,System.Reflection.Assembly,bool,uint,intptr&) [0x6ed1319220 - 0x6ed1319280 0x6ed1459ba1]
06-28 12:44:24.626 28233 28233 D Mono    : AOT NOT FOUND: (wrapper runtime-invoke) <Module>:runtime_invoke_void_object_object_byte_uint_intptr& (object,intptr,intptr,intptr).
06-28 12:44:24.626 28233 28233 D Mono    : AOT: FOUND method System.Runtime.InteropServices.NativeLibrary:LoadLibraryCallbackStub (string,System.Reflection.Assembly,bool,uint) [0x6ed1319660 - 0x6ed1319780 0x6ed1459bce]
06-28 12:44:24.627 28233 28233 D Mono    : Native library found via __Internal.
06-28 12:44:24.627 28233 28233 D Mono    : Native library found via filesystem probing: 'liblog'.
06-28 12:44:24.627 28233 28233 D Mono    : DllImport searching in: 'liblog' ('liblog.so').
06-28 12:44:24.627 28233 28233 D Mono    : Searching for '__android_log_print'.
06-28 12:44:24.627 28233 28233 D Mono    : AOT NOT FOUND: (wrapper managed-to-native) Interop/Logcat:<__android_log_print>g____PInvoke|0_0 (Interop/Logcat/LogLevel,byte*,byte*,byte*,intptr).
06-28 12:44:24.627 28233 28233 I DOTNET  : JavaProxyThrowable: translation threw an exception: Java.Lang.NullPointerException: Declaring class is null
06-28 12:44:24.627 28233 28233 D Mono    : AOT: FOUND method System.Text.StringBuilder:Append (System.ReadOnlySpan`1<char>) [0x6ed1209c00 - 0x6ed1209c60 0x6ed145225b]
06-28 12:44:24.627 28233 28233 I DOTNET  :    at Java.Interop.JniEnvironment.InstanceMethods.CallNonvirtualVoidMethod(JniObjectReference , JniObjectReference , JniMethodInfo , JniArgumentValue* )
06-28 12:44:24.627 28233 28233 I DOTNET  :    at Java.Interop.JniPeerMembers.JniInstanceMethods.FinishCreateInstance(String , IJavaPeerable , JniArgumentValue* )
06-28 12:44:24.627 28233 28233 I DOTNET  :    at Java.Lang.StackTraceElement..ctor(String , String , String , Int32 )
06-28 12:44:24.627 28233 28233 D Mono    : AOT: FOUND method System.Text.StringBuilder:Clear () [0x6ed1207bd0 - 0x6ed1207c10 0x6ed145218f]
06-28 12:44:24.627 28233 28233 D Mono    : AOT: FOUND method System.Text.StringBuilder:set_Length (int) [0x6ed1207c40 - 0x6ed1207ed0 0x6ed1452197]
06-28 12:44:24.627 28233 28233 D Mono    : AOT: FOUND method System.Text.StringBuilder:FindChunkForIndex (int) [0x6ed120cc60 - 0x6ed120cce0 0x6ed14522fd]
06-28 12:44:24.627 28233 28233 I DOTNET  :    at Android.Runtime.JavaProxyThrowable.TranslateStackTrace()
06-28 12:44:24.627 28233 28233 I DOTNET  :    at Android.Runtime.JavaProxyThrowable.Create(Exception )
06-28 12:44:24.627 28233 28233 I DOTNET  :   --- End of managed Java.Lang.NullPointerException stack trace ---
06-28 12:44:24.627 28233 28233 I DOTNET  : java.lang.NullPointerException: Declaring class is null
06-28 12:44:24.627 28233 28233 I DOTNET  :  at java.util.Objects.requireNonNull(Objects.java:232)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at java.lang.StackTraceElement.<init>(StackTraceElement.java:92)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7705)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.os.Handler.dispatchMessage(Handler.java:106)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.os.Looper.loopOnce(Looper.java:230)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.os.Looper.loop(Looper.java:319)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.ActivityThread.main(ActivityThread.java:8913)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at java.lang.reflect.Method.invoke(Native Method)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
06-28 12:44:24.627 28233 28233 I DOTNET  : 
06-28 12:44:24.627 28233 28233 I DOTNET  :   --- End of managed Java.Lang.NullPointerException stack trace ---
06-28 12:44:24.627 28233 28233 I DOTNET  : java.lang.NullPointerException: Declaring class is null
06-28 12:44:24.627 28233 28233 I DOTNET  :  at java.util.Objects.requireNonNull(Objects.java:232)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at java.lang.StackTraceElement.<init>(StackTraceElement.java:92)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7705)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.os.Handler.dispatchMessage(Handler.java:106)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.os.Looper.loopOnce(Looper.java:230)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.os.Looper.loop(Looper.java:319)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at android.app.ActivityThread.main(ActivityThread.java:8913)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at java.lang.reflect.Method.invoke(Native Method)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
06-28 12:44:24.627 28233 28233 I DOTNET  :  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
06-28 12:44:24.627 28233 28233 D Mono    : AOT: FOUND method System.ArgumentException:get_Message () [0x6ed10d3430 - 0x6ed10d34f0 0x6ed14491c6]
06-28 12:44:24.627 28233 28233 D Mono    : AOT: FOUND method System.ArgumentException:SetMessageField () [0x6ed10d34f0 - 0x6ed10d3580 0x6ed14491cf]
06-28 12:44:24.627 28233 28233 D Mono    : AOT: FOUND method string:Concat (string,string,string) [0x6ed10bafb0 - 0x6ed10bb120 0x6ed1448660]
06-28 12:44:24.628 28233 28233 D Mono    : AOT NOT FOUND: (wrapper managed-to-native) object:__icall_wrapper_mono_thread_get_undeniable_exception ().
06-28 12:44:24.628 28233 28233 D Mono    : AOT: FOUND method Android.Runtime.AndroidEnvironment:RaiseThrowable (Java.Lang.Throwable) [0x6eccba3ad0 - 0x6eccba3b50 0x6ecccd2e78]
06-28 12:44:24.628 28233 28233 D Mono    : AOT: FOUND method Android.Runtime.JNIEnv:Throw (intptr) [0x6eccbc3e30 - 0x6eccbc3ef0 0x6ecccd3de7]
06-28 12:44:24.628 28233 28233 D Mono    : AOT: FOUND method Java.Interop.JniEnvironment/Exceptions:Throw (Java.Interop.JniObjectReference) [0x6eca4821c0 - 0x6eca4822b0 0x6eca4d1fc9]
06-28 12:44:24.628 28233 28233 D Mono    : AOT: FOUND method Java.Interop.JniEnvironment/Exceptions:_Throw (Java.Interop.JniObjectReference) [0x6eca4823c0 - 0x6eca482510 0x6eca4d1fd4]
06-28 12:44:24.628 28233 28233 D AndroidRuntime: Shutting down VM
--------- beginning of crash
06-28 12:44:24.628 28233 28233 E AndroidRuntime: FATAL EXCEPTION: main
06-28 12:44:24.628 28233 28233 E AndroidRuntime: Process: com.gabrielmackoz.MKFlasher, PID: 28233
06-28 12:44:24.628 28233 28233 E AndroidRuntime: android.runtime.JavaProxyThrowable: System.TypeInitializationException: TypeInitialization_Type, MKFlasher.ViewModels.FirebaseUserViewModel
06-28 12:44:24.628 28233 28233 E AndroidRuntime:  ---> System.ArgumentNullException: ArgumentNull_Generic Arg_ParamName_Name, provider
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[IFirebaseAuthClient](IServiceProvider )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at MKFlasher.ViewModels.FirebaseUserViewModel..ctor()
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at MKFlasher.ViewModels.FirebaseUserViewModel..cctor()
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    Exception_EndOfInnerExceptionStack
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Constructor(Object obj, IntPtr* args)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object , Span`1 , BindingFlags )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object , BindingFlags , Binder , Object[] , CultureInfo )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags , Binder , Object[] , CultureInfo )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite , RuntimeResolverContext )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    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 , RuntimeResolverContext )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite , RuntimeResolverContext )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    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)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite , ServiceProviderEngineScope )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    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 , Func`2 )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier , ServiceProviderEngineScope )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider , Type )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IApplication](IServiceProvider )
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Microsoft.Maui.MauiApplication.OnCreate()
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Android.App.Application.n_OnCreate(IntPtr jnienv, IntPtr native__this)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7705)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at android.os.Looper.loopOnce(Looper.java:230)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:319)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:8913)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
06-28 12:44:24.628 28233 28233 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
06-28 12:44:24.628 28233 28233 D Mono    : Request to load Mono.Android in alc 0xb4000070ccd5fe70
06-28 12:44:24.628 28233 28233 D Mono    : Assembly already loaded in the active ALC: 'Mono.Android'.
06-28 12:44:24.629 28233 28233 D Mono    : AOT: FOUND method Android.Runtime.JNIEnv:PropagateUncaughtException (intptr,intptr,intptr) [0x6eccbc24a0 - 0x6eccbc29d0 0x6ecccd3d4e]
06-28 12:44:24.629 28233 28233 D Mono    : AOT NOT FOUND: (wrapper runtime-invoke) <Module>:runtime_invoke_void_intptr_intptr_intptr (object,intptr,intptr,intptr).
06-28 12:44:24.629 28233 28233 D Mono    : AOT: FOUND method Android.Runtime.JNIEnv:Initialize () [0x6eccbc2470 - 0x6eccbc24a0 0x6ecccd3d4a]
06-28 12:44:24.629 28233 28233 D Mono    : AOT: FOUND method Android.Runtime.AndroidRuntimeInternal:InitializeUnhandledExceptionMethod () [0x6f4f41a4f0 - 0x6f4f41a700 0x6f4f41aba9]
06-28 12:44:24.629 28233 28233 D Mono    : AOT: module Mono.Android.Runtime.dll.so wants to load image 1: System.Private.CoreLib
06-28 12:44:24.629 28233 28233 D Mono    : AOT: FOUND method Android.Runtime.Logger:Log (Android.Runtime.LogLevel,string,string) [0x6eccbd86f0 - 0x6eccbd88e0 0x6ecccd4a85]
06-28 12:44:24.629 28233 28233 D Mono    : AOT: FOUND method string:Split (string[],System.StringSplitOptions) [0x6ed10c2ed0 - 0x6ed10c2f30 0x6ed1448855]
06-28 12:44:24.629 28233 28233 D Mono    : AOT: FOUND method string:SplitInternal (string,string[],int,System.StringSplitOptions) [0x6ed10c2f90 - 0x6ed10c34d0 0x6ed144885d]
06-28 12:44:24.629 28233 28233 D Mono    : AOT: FOUND method string:MakeSeparatorListAny (System.ReadOnlySpan`1<char>,System.ReadOnlySpan`1<string>,System.Collections.Generic.ValueListBuilder`1<int>&,System.Collections.Generic.ValueListBuilder`1<int>&) [0x6ed10c4ec0 - 0x6ed10c5290 0x6ed144889d]
06-28 12:44:24.629 28233 28233 D Mono    : AOT: FOUND method string:CreateSplitArrayOfThisAsSoleValue (System.StringSplitOptions,int) [0x6ed10c34d0 - 0x6ed10c35b0 0x6ed144886c]
06-28 12:44:24.629 28233 28233 D Mono    : AOT: NOT FOUND: Android.Runtime.Logger:__android_log_print (Android.Runtime.LogLevel,string,string,string,intptr).
06-28 12:44:24.629 28233 28233 D monodroid-assembly: monodroid_dlopen: hash for name 'liblog' is 0xce23a84560fcc512
06-28 12:44:24.629 28233 28233 D monodroid-assembly: monodroid_dlopen: hash match not found, DSO name is '<unknown>'
06-28 12:44:24.629 28233 28233 I monodroid-assembly: Trying to load shared library '/data/app/~~Z_0gGPc6lrFLUMmJ8-Amrw==/com.gabrielmackoz.MKFlasher-6N-Lx-w6GpEkEmyKHWhb4A==/lib/arm64/liblog'
06-28 12:44:24.629 28233 28233 I monodroid-assembly: Shared library '/data/app/~~Z_0gGPc6lrFLUMmJ8-Amrw==/com.gabrielmackoz.MKFlasher-6N-Lx-w6GpEkEmyKHWhb4A==/lib/arm64/liblog' not found
06-28 12:44:24.629 28233 28233 I monodroid-assembly: Trying to load shared library 'liblog'
06-28 12:44:24.629 28233 28233 I monodroid-assembly: Shared library 'liblog' not found
06-28 12:44:24.629 28233 28233 W monodroid-assembly: Shared library 'liblog' not loaded, p/invoke '__android_log_print' may fail
06-28 12:44:24.629 28233 28233 D Mono    : DllImport attempting to load: 'liblog'.
06-28 12:44:24.629 28233 28233 D Mono    : Native library found in the active ALC cache: 'liblog'.
06-28 12:44:24.629 28233 28233 D Mono    : DllImport searching in: 'liblog' ('liblog.so').
06-28 12:44:24.629 28233 28233 D Mono    : Searching for '__android_log_print'.
06-28 12:44:24.629 28233 28233 D Mono    : AOT NOT FOUND: (wrapper managed-to-native) Android.Runtime.Logger:__android_log_print (Android.Runtime.LogLevel,string,string,string,intptr).
06-28 12:44:24.629 28233 28233 I MonoDroid: UNHANDLED EXCEPTION:
06-28 12:44:24.629 28233 28233 I MonoDroid: Android.Runtime.JavaProxyThrowable: Exception_WasThrown, Android.Runtime.JavaProxyThrowable
06-28 12:44:24.629 28233 28233 I MonoDroid: 
06-28 12:44:24.629 28233 28233 I MonoDroid:   --- End of managed Android.Runtime.JavaProxyThrowable stack trace ---
06-28 12:44:24.629 28233 28233 I MonoDroid: android.runtime.JavaProxyThrowable: System.TypeInitializationException: TypeInitialization_Type, MKFlasher.ViewModels.FirebaseUserViewModel
06-28 12:44:24.629 28233 28233 I MonoDroid:  ---> System.ArgumentNullException: ArgumentNull_Generic Arg_ParamName_Name, provider
06-28 12:44:24.629 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[IFirebaseAuthClient](IServiceProvider )
06-28 12:44:24.629 28233 28233 I MonoDroid:    at MKFlasher.ViewModels.FirebaseUserViewModel..ctor()
06-28 12:44:24.629 28233 28233 I MonoDroid:    at MKFlasher.ViewModels.FirebaseUserViewModel..cctor()
06-28 12:44:24.629 28233 28233 I MonoDroid:    Exception_EndOfInnerExceptionStack
06-28 12:44:24.629 28233 28233 I MonoDroid:    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Constructor(Object obj, IntPtr* args)
06-28 12:44:24.629 28233 28233 I MonoDroid:    at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object , Span`1 , BindingFlags )
06-28 12:44:24.629 28233 28233 I MonoDroid:    at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object , BindingFlags , Binder , Object[] , CultureInfo )
06-28 12:44:24.629 28233 28233 I MonoDroid:    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags , Binder , Object[] , CultureInfo )
06-28 12:44:24.629 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite , RuntimeResolverContext )
06-28 12:44:24.629 28233 28233 I MonoDroid:    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 , RuntimeResolverContext )
06-28 12:44:24.629 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite , RuntimeResolverContext )
06-28 12:44:24.629 28233 28233 I MonoDroid:    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)
06-28 12:44:24.629 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite , ServiceProviderEngineScope )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
06-28 12:44:24.630 28233 28233 I MonoDroid:    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 , Func`2 )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier , ServiceProviderEngineScope )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider , Type )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IApplication](IServiceProvider )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Maui.MauiApplication.OnCreate()
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Android.App.Application.n_OnCreate(IntPtr jnienv, IntPtr native__this)
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7705)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.os.Handler.dispatchMessage(Handler.java:106)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.os.Looper.loopOnce(Looper.java:230)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.os.Looper.loop(Looper.java:319)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.ActivityThread.main(ActivityThread.java:8913)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at java.lang.reflect.Method.invoke(Native Method)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
06-28 12:44:24.630 28233 28233 I MonoDroid: 
06-28 12:44:24.630 28233 28233 I MonoDroid:   --- End of managed Android.Runtime.JavaProxyThrowable stack trace ---
06-28 12:44:24.630 28233 28233 I MonoDroid: android.runtime.JavaProxyThrowable: System.TypeInitializationException: TypeInitialization_Type, MKFlasher.ViewModels.FirebaseUserViewModel
06-28 12:44:24.630 28233 28233 I MonoDroid:  ---> System.ArgumentNullException: ArgumentNull_Generic Arg_ParamName_Name, provider
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[IFirebaseAuthClient](IServiceProvider )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at MKFlasher.ViewModels.FirebaseUserViewModel..ctor()
06-28 12:44:24.630 28233 28233 I MonoDroid:    at MKFlasher.ViewModels.FirebaseUserViewModel..cctor()
06-28 12:44:24.630 28233 28233 I MonoDroid:    Exception_EndOfInnerExceptionStack
06-28 12:44:24.630 28233 28233 I MonoDroid:    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Constructor(Object obj, IntPtr* args)
06-28 12:44:24.630 28233 28233 I MonoDroid:    at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object , Span`1 , BindingFlags )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object , BindingFlags , Binder , Object[] , CultureInfo )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags , Binder , Object[] , CultureInfo )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite , RuntimeResolverContext )
06-28 12:44:24.630 28233 28233 I MonoDroid:    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 , RuntimeResolverContext )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite , RuntimeResolverContext )
06-28 12:44:24.630 28233 28233 I MonoDroid:    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)
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite , ServiceProviderEngineScope )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
06-28 12:44:24.630 28233 28233 I MonoDroid:    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 , Func`2 )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier , ServiceProviderEngineScope )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider , Type )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IApplication](IServiceProvider )
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Microsoft.Maui.MauiApplication.OnCreate()
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Android.App.Application.n_OnCreate(IntPtr jnienv, IntPtr native__this)
06-28 12:44:24.630 28233 28233 I MonoDroid:    at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7705)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.os.Handler.dispatchMessage(Handler.java:106)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.os.Looper.loopOnce(Looper.java:230)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.os.Looper.loop(Looper.java:319)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at android.app.ActivityThread.main(ActivityThread.java:8913)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at java.lang.reflect.Method.invoke(Native Method)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
06-28 12:44:24.630 28233 28233 I MonoDroid:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
06-28 12:44:24.630 28233 28233 I MonoDroid: 
06-28 12:44:24.630 28233 28233 D Mono    : AOT NOT FOUND: (wrapper managed-to-native) Android.Runtime.RuntimeNativeMethods:monodroid_unhandled_exception (System.Exception).
06-28 12:44:24.630 28233 28233 D Mono    : AOT NOT FOUND: (wrapper runtime-invoke) <Module>:runtime_invoke_object__this__ (object,intptr,intptr,intptr).
06-28 12:44:24.631  1843  6219 E ActivityManager: App crashed on incremental package com.gabrielmackoz.MKFlasher which is 100% loaded.
github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

RobTF commented 3 months ago

Hi,

The AOT stuff is pretty glitched, try adding

<RunAOTCompilation>False</RunAOTCompilation>

to your .csproj for Android release builds, e.g.

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
    <RunAOTCompilation>False</RunAOTCompilation>
</PropertyGroup>
gabriel-kozma commented 3 months ago

Hi,

The AOT stuff is pretty glitched, try adding

<RunAOTCompilation>False</RunAOTCompilation>

to your .csproj for Android release builds, e.g.

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
  <RunAOTCompilation>False</RunAOTCompilation>
</PropertyGroup>

The problem is, I need aot, I've waited to update to maui from Xamarin, since IL stripping didn't work on maui and with .net 8 they've added support

gabriel-kozma commented 3 months ago

Just tried without AOT and still crashes

RobTF commented 3 months ago

Maybe it's not AOT then - but you mentioned IL stripping - maybe something there is being too aggressive? Maybe post your settings w.r.t. any IL stripping that's taking place.

gabriel-kozma commented 3 months ago

it was a combination of and IL stripping, is there a way to control IL removing?

wagenheimer commented 3 months ago

I'm encountering the same issue; disabling AOT didn't resolve it. I urgently need to create a release build. Is there a workaround available?

wagenheimer commented 3 months ago

It appears that dependency injection fails to work as expected in release mode; it crashes when a parameterless constructor is absent.

gabriel-kozma commented 2 months ago

It appears that dependency injection fails to work as expected in release mode; it crashes when a parameterless constructor is absent.

Have you figured out a workaround?

PureWeen commented 2 months ago

@jonathanpeppers thoughts?

wagenheimer commented 2 months ago

In the end, the error was due to an incorrect definition in my XAML. The issue was that the actual error wasn't displayed anywhere. Correcting the XAML resolved the issue with Dependency Injection.

jonathanpeppers commented 2 months ago

There is a lack of information here, to know what went wrong.

@gabriel-kozma said:

it was a combination of and IL stripping, is there a way to control IL removing?

What was the setting that worked vs didn't work?

There is an issue related to the experimental $(AndroidStripILAfterAOT) setting, that should be fixed in .NET 9 now:

gabriel-kozma commented 2 months ago

hi @jonathanpeppers just using IL stripping causes the app to crash, I could try the .net 9, but I would need to wait for production to release it?

Can this be back ported to .net 8?

I'll try here and report back

jonathanpeppers commented 2 months ago

You could comment on https://github.com/dotnet/runtime/pull/103975 and ask if it is going back to .NET 8.

gabriel-kozma commented 2 months ago

Thank you @jonathanpeppers is there a way for me to add more logging in order to figure out how is breaking?

gabriel-kozma commented 2 months ago

I followed what @wagenheimer said and started looking, I'm not using XAML anymore, but I've had some code comments with the Xamarin.Forms xaml and it was this that was causing the problem with IL Stripping

another question I have @jonathanpeppers is were the empty dlls are stored on the release application? In xamarin they were stored at a file monodroidbundle which cointaned all dlls and I could verify that they were indeed stripped of their IL

jonathanpeppers commented 2 months ago

On Android, .NET assemblies are compressed into a single file that can be mmap'd in one call.

You can use either of these tools to inspect or pull them out of an .apk:

samhouts commented 2 months ago

Is this issue good to close now? Thanks!

jfversluis commented 2 months ago

No response, so I assume its good to close!