Skip to content

NET10 - Exception on quit #32600

Closed
Closed

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

Activity

  1. added
    t/bug
    on Nov 13, 2025
  2. Ahamed-Ali commented on Nov 14, 2025

    @Ahamed-Ali
    Contributor

    This issue has been validated in Visual Studio Code 1.105.1 with MAUI versions 10.0.0 Preview 1, 10.0.0-preview7,10.0.0-rc1, 10.0.0-rc2 and 10.0.10 . It can be reproduced on Android platform from 10.0.0-rc1 versions

    MauiApp13.zip

  3. added
    s/verified
    s/triaged
    i/regression
    on Nov 14, 2025
  4. sheharyarshahid commented on Nov 14, 2025

    @sheharyarshahid

    I'm getting the following exception when on app startup for Android. It used to work fine in 9.0.120.

    Current Version: 10.0.10

    An unhandled exception of type 'Android.Runtime.JavaProxyThrowable' occurred in Mono.Android.Runtime.dll
    
    11-14 12:34:20.186 E/AndroidRuntime( 1571): FATAL EXCEPTION: main
    11-14 12:34:20.186 E/AndroidRuntime( 1571): Process: com.smartapp.app, PID: 1571
    11-14 12:34:20.186 E/AndroidRuntime( 1571): android.runtime.JavaProxyThrowable: [System.InvalidCastException]: Unable to convert instance of type 'Android.Widget.FrameLayout' to type 'Google.Android.Material.AppBar.AppBarLayout'.
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at Java.Interop.JavaObjectExtensions._JavaCast + 0x5e(Unknown Source)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at Java.Interop.JavaObjectExtensions.JavaCast + 0x0(Unknown Source)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at Android.Runtime.Extensions.JavaCast + 0x0(Unknown Source)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at Android.Views.View.FindViewById + 0x0(Unknown Source)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at Microsoft.Maui.Platform.MauiWindowInsetListener.ApplyDefaultWindowInsets(/_/src/Core/src/Platform/Android/MauiWindowInsetListener.cs:225)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at Microsoft.Maui.Platform.MauiWindowInsetListener.OnApplyWindowInsets(/_/src/Core/src/Platform/Android/MauiWindowInsetListener.cs:209)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at AndroidX.Core.View.IOnApplyWindowInsetsListenerInvoker.n_OnApplyWindowInsets_Landroid_view_View_Landroidx_core_view_WindowInsetsCompat_ + 0x10(Unknown Source)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at crc6452ffdc5b34af3a0f.MauiWindowInsetListener.n_onApplyWindowInsets(Native Method)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at crc6452ffdc5b34af3a0f.MauiWindowInsetListener.onApplyWindowInsets(MauiWindowInsetListener.java:61)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at androidx.core.view.ViewCompat$Api21Impl$1.onApplyWindowInsets(ViewCompat.java:5322)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.View.dispatchApplyWindowInsets(View.java:13210)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7898)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.newDispatchApplyWindowInsets(ViewGroup.java:7923)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7905)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.newDispatchApplyWindowInsets(ViewGroup.java:7923)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7905)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.newDispatchApplyWindowInsets(ViewGroup.java:7923)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7905)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.newDispatchApplyWindowInsets(ViewGroup.java:7923)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7905)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.newDispatchApplyWindowInsets(ViewGroup.java:7923)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7905)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewRootImpl.dispatchApplyInsets(ViewRootImpl.java:4406)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4580)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3924)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:12903)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1901)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1910)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.Choreographer.doCallbacks(Choreographer.java:1367)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.Choreographer.doFrame(Choreographer.java:1292)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1870)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.os.Handler.handleCallback(Handler.java:995)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.os.Handler.dispatchMessage(Handler.java:103)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.os.Looper.loopOnce(Looper.java:273)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.os.Looper.loop(Looper.java:363)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at android.app.ActivityThread.main(ActivityThread.java:10060)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at java.lang.reflect.Method.invoke(Native Method)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
    11-14 12:34:20.186 E/AndroidRuntime( 1571): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
    11-14 12:34:20.191 I/rtestimator.app( 1571): Compiler allocated 5122KB to compile void android.view.ViewRootImpl.performTraversals()
    An error occurred in the vsdbg debug session of project 'D:\repos\launchx\smart_estimator_web\App\SmartEstimator\SmartEstimator.csproj': An unhandled exception of type 'Android.Runtime.JavaProxyThrowable' occurred in Mono.Android.Runtime.dll
    The program 'SmartEstimator.dll' has exited with code 0 (0x0).
    11-14 12:38:23.622 W/monodroid-assembly( 1571): Shared library 'liblog' not loaded, p/invoke '__android_log_print' may fail
    
  5. added
    partner/syncfusion
    on Nov 14, 2025
  6. added this to the .NET 10.0 SR1.1 milestone on Nov 14, 2025
  7. added
    p/0
    on Nov 14, 2025
  8. self-assigned this
    on Nov 15, 2025
  9. removed this from the .NET 10.0 SR1.1 milestone on Nov 15, 2025
  10. 39 remaining items

  11. kubaflo commented on Jan 28, 2026

    @kubaflo
    Contributor

    Hi! could you please test #33720?
    It would be super helpful if you could confirm whether the fix works in your apps.
    Thanks a lot!

  12. FleoRDI commented on Jan 29, 2026

    @FleoRDI

    @kubaflo Hello, sorry, but i don't think that applies to me as my app doens't even open up, so i can't even know if it does that when backbutton is pressed, i also went from .net9 to 10 before having that issue, it's the same issue sheharyarshahid first mentioned, not the one coming from the backbutton's event.

  13. brzezinol commented on Feb 12, 2026

    @brzezinol

    @kubaflo
    I think it still not work.

    Visual Studio Version 18.2.2
    
    Mono Debugging for Visual Studio   18.0.15 (76f6142551)
    
    Narzędzia .NET MAUI   18.0.345 (fbde6c01f0)
    
    Narzędzia języka C#   5.0.0-2.26054.2+ec501e4c6f2689c9c71e38ce72d892675965c392
    
    Xamarin Designer   18.0.1.33 (remotes/origin/HEAD@44462085bc)
    

    Code below causes crash.

    Intent resultIntent = new();
    resultIntent.PutExtra("scanned_uri", Android.Net.Uri.Parse(uri));
    Platform.CurrentActivity.SetResult(Result.Ok, resultIntent);
    Platform.CurrentActivity.Finish();
    

    Edit
    after dotnet workloads update it seems to work properly.

  14. kubaflo commented on Oct 18, 2026

    @kubaflo
    Contributor

    Fixed here #32647

  15. moved this from In Progress to Done in MAUI SDK Ongoingon Oct 18, 2026
  16. locked and limited conversation to collaborators on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

i/regressionp/0platform/androidregressed-in-10-rc1s/triageds/verifiedt/bug

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions