Skip to content

Going back using 'Shell.Current.GoToAsync("..")' causes a crash, but only when using a Mouse on an Android. #19461

@Realinspirer

Description

@Realinspirer

Description

...and due to a completely out of the world reason. At least that's what I am assuming.

So, I have a secondary back button in the ContentPage, which calls GoToAsync("..") to go back. Please note that I was using Windows Subsystem for Android™️ for this testing, but I do believe this might be reproducible on any Android device with a connected mouse (though not tested).
The button works perfectly when I tap it with my finger, but when I use the cursor to click the button, it crashes, and throws a NullReferenceException. I think what actually happens is MAUI tries to send a onhover call after the back button is clicked, but the reference is cleared, and it crashes as a result, whereas in a tap, it doesn't have to send that hover event.

Here's a video demonstration:

43gg.mp4

Or I might be completely wrong about this, because it seems that abnormal.

Steps to Reproduce

  1. Add two pages to a new app, and navigate to second page from first page.
  2. Add a button to the second page, and have it call Shell.Current.GoToAsync("..")
  3. On WSA/Android with a mouse, click on the Back button to get the NullReferenceException.

Link to public reproduction project repository

https://github.com/Realinspirer/tempcheck

Version with bug

8.0.3

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 13 (others not checked)

Did you find any workaround?

A cheap workaround, kind of obvious, but may not work at times, is - disabling the back button before the page transition, so that the after events doesn't get into account.

Relevant log output

**System.NullReferenceException:** 'Object reference not set to an instance of an object.'

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions