Skip to content

Android Back Button Crash With Shell.TitleView #33483

@DanielKeeley

Description

@DanielKeeley

Description

On Android, when navigating back to the home page and then minimising with the phone's back button, the app crashes. "Android.Runtime.JavaProxyThrowable".

When you update the Maui Controls Nuget from 10.0.1 to 10.0.20 (latest) it will still crash but if you have a custom Shell.TitleView, could be anything even a basic Label

    <Shell.TitleView>
        <Label Text="TITLE VIEW"/>
    </Shell.TitleView> 

Steps to Reproduce

  1. Create a new Maui project, .net10
  2. Add a new page that you will navigate to "OtherPage"
  3. On the MainPage, change the button's function to go to OtherPage Shell.Current.GoToAsync(nameof(OtherPage));
  4. Register the new page in AppShell.xaml.cs
  5. Update the Maui Controls Nuget to the latest version (10.0.20)
  6. In AppShell.xaml, within , add this```
    <Shell.TitleView>

    </Shell.TitleView>
7. Run the app on android
8. Click the button to go to OtherPage
9. Quickly press the phone's back button until the app minimises
10. Try to go back to the app again and notice that it has crashed and the app is now restarting
11. Sometimes it fails to restart and crashes again

### Link to public reproduction project repository

_No response_

### Version with bug

10.0.20

### 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

android                    36.1.2/10.0.100          SDK 10.0.100, VS 18.1.11304.174, VS 17.14.36705.20

### Did you find any workaround?

None.

### Relevant log output

```shell
01-12 15:51:50.776 W/WindowOnBackDispatcher(15705): OnBackInvokedCallback is not enabled for the application.
01-12 15:51:50.776 W/WindowOnBackDispatcher(15705): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
01-12 15:51:50.797 D/EGL_emulation(15705): app_time_stats: avg=344.70ms min=13.38ms max=8200.11ms count=25
01-12 15:51:51.472 D/VRI[MainActivity](15705): visibilityChanged oldVisibility=true newVisibility=false
01-12 15:51:51.565 W/WindowOnBackDispatcher(15705): sendCancelIfRunning: isInProgress=false callback=android.view.ViewRootImpl$$ExternalSyntheticLambda11@f122893
The thread '.NET TP Worker' (20) has exited with code 0 (0x0).
The thread '.NET TP Worker' (14) has exited with code 0 (0x0).
The program 'AndroidCrashMauiApp.dll' has exited with code 0 (0x0).
The vsdbg debug session for project 'C:\Users\Daniel\source\repos\AndroidCrashMauiApp\AndroidCrashMauiApp\AndroidCrashMauiApp.csproj' has been stopped


My main app is hooked up to Sentry, which reports this error
"System.ObjectDisposedException
ObjectDisposed_Generic ObjectDisposed_ObjectName_Name, IServiceProvider"

Metadata

Metadata

Assignees

No one assigned

    Labels

    t/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions