Skip to content

NET10 - Exception on quit #32600

@GiorgioITS

Description

@GiorgioITS

Description

Android application created with NET MAUI 10 (latest release - Long Term Support)
Tested in Emulator API 36
With the MainPage on screen, clicking the Back button passes though an unhandled exception before closing the app.

Steps to Reproduce

  1. Create an application NET MAUI 10.0
  2. Capture lifecycle events
  3. Start Android emulator, API 36
  4. Run the application
  5. Click the Back button
    Expected result: the application quits
    Actual result: Unhandled exception ‘Android.Runtime.JavaProxyThrowable’ showing for a few seconds, then the app quits

Link to public reproduction project repository

No response

Version with bug

10.0.10

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.120 SR12

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

NO workaround. Albeit the issue does not in fact affect the application, it is a symptom of something wrong.

Relevant log output

Output after clicking the Back button:

Back button pressed in MainPage
Android Lifecycle event: OnBackPressed
Android Lifecycle event: OnPause
11-13 19:02:13.016 D/VRI[MainActivity]( 7075): visibilityChanged oldVisibility=true newVisibility=false
11-13 19:02:13.139 D/AndroidRuntime( 7075): Shutting down VM
11-13 19:02:13.141 E/AndroidRuntime( 7075): FATAL EXCEPTION: main
11-13 19:02:13.141 E/AndroidRuntime( 7075): Process: com.companyname.lifecycle, PID: 7075
11-13 19:02:13.141 E/AndroidRuntime( 7075): android.runtime.JavaProxyThrowable: [System.ObjectDisposedException]: Cannot access a disposed object.
11-13 19:02:13.141 E/AndroidRuntime( 7075): Object name: 'IServiceProvider'.
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException + 0x0(Unknown Source)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService + 0x8(Unknown Source)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Microsoft.Maui.MauiContext+WrappedServiceProvider.GetService(/_/src/Core/src/MauiContext.cs:87)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Microsoft.Maui.MauiContext+WrappedServiceProvider.GetService(/_/src/Core/src/MauiContext.cs:87)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService + 0x28(Unknown Source)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService + 0xb(Unknown Source)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Microsoft.Maui.MauiContextExtensions.GetDispatcher(/_/src/Core/src/MauiContextExtensions.cs:33)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Microsoft.Maui.Controls.Platform.Compatibility.ShellFragmentContainer.OnDestroy(/_/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFragmentContainer.cs:43)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at AndroidX.Fragment.App.Fragment.n_OnDestroy(C:\a\_work\1\s\generated\androidx.fragment.fragment\obj\Release
et10.0-android\generated\src\AndroidX.Fragment.App.Fragment.cs:2465)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw + 0x11(Unknown Source)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod + 0x86(Unknown Source)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod + 0x65(Unknown Source)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Android.App.Activity.OnDestroy + 0x0(Unknown Source)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Microsoft.Maui.MauiAppCompatActivity.OnDestroy(/_/src/Core/src/Platform/Android/MauiAppCompatActivity.cs:37)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at Android.App.Activity.n_OnDestroy + 0xe(Unknown Source)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at crc6488302ad6e9e4df1a.MauiAppCompatActivity.n_onDestroy(Native Method)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at crc6488302ad6e9e4df1a.MauiAppCompatActivity.onDestroy(MauiAppCompatActivity.java:59)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.Activity.performDestroy(Activity.java:9460)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1556)
OnSleep
Android Lifecycle event: OnStop
Android Lifecycle event: OnDestroy
An unhandled exception of type 'Android.Runtime.JavaProxyThrowable' occurred in Mono.Android.Runtime.dll

11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:6256)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:6301)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:52)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:63)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.servertransaction.TransactionExecutor.executeLifecycleItem(TransactionExecutor.java:169)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:101)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2823)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.os.Handler.dispatchMessage(Handler.java:110)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.os.Looper.loopOnce(Looper.java:248)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.os.Looper.loop(Looper.java:338)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at android.app.ActivityThread.main(ActivityThread.java:9067)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at java.lang.reflect.Method.invoke(Native Method)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
11-13 19:02:13.141 E/AndroidRuntime( 7075): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)
An error occurred in the vsdbg debug session of project 'C:\Users\Coding\source\repos\TestMaui10\Lifecycle\Lifecycle.csproj': An unhandled exception of type 'Android.Runtime.JavaProxyThrowable' occurred in Mono.Android.Runtime.dll
11-13 19:02:17.621 W/monodroid-assembly( 7075): Shared library 'liblog' not loaded, p/invoke '__android_log_print' may fail
11-13 19:02:17.621 I/MonoDroid( 7075): UNHANDLED EXCEPTION:
11-13 19:02:17.621 I/MonoDroid( 7075): Android.Runtime.JavaProxyThrowable: Exception of type 'Android.Runtime.JavaProxyThrowable' was thrown.
11-13 19:02:17.622 I/MonoDroid( 7075): 
11-13 19:02:17.622 I/MonoDroid( 7075):   --- End of managed Android.Runtime.JavaProxyThrowable stack trace ---
11-13 19:02:17.622 I/MonoDroid( 7075): android.runtime.JavaProxyThrowable
11-13 19:02:17.622 I/MonoDroid( 7075): 
The program 'Lifecycle.dll' has exited with code 0 (0x0).
11-13 19:02:17.646 I/Process ( 7075): Sending signal. PID: 7075 SIG: 9
The vsdbg debug session for project 'C:\Users\Coding\source\repos\TestMaui10\Lifecycle\Lifecycle.csproj' has been stopped

Metadata

Metadata

Assignees

Labels

i/regressionThis issue described a confirmed regression on a currently supported versionp/0Current heighest priority issues that we are targeting for a release.platform/androidregressed-in-10-rc1s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

Type

No type

Projects

Status

In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions