dadhi / DryIoc

DryIoc is fast, small, full-featured IoC Container for .NET
MIT License
1.03k stars 122 forks source link

[System.Reflection.TargetInvocationException]: Exception has been thrown by the target of an invocation #662

Closed LeoJHarris closed 1 month ago

LeoJHarris commented 1 month ago

Currently having an issue with [System.Reflection.TargetInvocationException]: Exception has been thrown by the target of an invocation

We use Prism in our MAUI application and are getting the following crash happening when the app launches, mainly posting here as I just need some direction on who maybe able to assist with this or get more information on it. Would this be referring to a specific Service?

Time Device Name Type PID Tag Message 10-31 11:25:42.840 Samsung SM-G991U Info 27007 MonoDroid android.runtime.JavaProxyThrowable: [System.Reflection.TargetInvocationException]: Exception has been thrown by the target of an invocation. at DryIoc.Interpreter.TryInterpretSingletonAndUnwrapContainerException(Unknown Source:0) at DryIoc.Factory.ApplyReuse(Unknown Source:0) at DryIoc.Factory.GetExpressionOrDefault(Unknown Source:0) at DryIoc.Container.ResolveAndCache(Unknown Source:0) at DryIoc.Container.System.IServiceProvider.GetService(Unknown Source:0) at Microsoft.Maui.MauiContext+WrappedServiceProvider.GetService(Unknown Source:0) at Microsoft.Maui.MauiContext+WrappedServiceProvider.GetService(Unknown Source:0) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(Unknown Source:0) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(Unknown Source:0) at Microsoft.Maui.MauiApplication.OnCreate(Unknown Source:0) at Android.App.Application.n_OnCreate(Unknown Source:0) at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(Unknown Source:0) at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method) at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7711) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:8919) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

Is there any suggestion on how we can investigate this? We don't have the issue with our Android App running in Debug Config but on the Release build.

LeoJHarris commented 1 month ago

When we removed removed r8 i.e. <!--<AndroidLinkTool>r8</AndroidLinkTool>--> we don't get the issue, not sure if this helps.

LeoJHarris commented 1 month ago

Closing the issue as it was due to missing proguard rules and after putting a try catch and checking the inner exception.

dadhi commented 1 month ago

thanks for the update!