Skip to content

Switching Tabs after resuming from background throws System.NullReferenceException on Android #12498

Closed

Description

Description

When using Tabbed shell page in MAUI project using Android. (Pixel 5 Emulator API 33 also reproduce the problem). If you send the app to the background, and open it again. Switching tabs now will cause a System.NullReferenceException.

Steps to Reproduce

  1. Create a new .NET MAUI Project.
  2. Replace the content of AppShell.xaml with the content from the following.
    <TabBar x:Name="TabBar">
        <Tab Title="Tab1" 
             >
            <ShellContent ContentTemplate="{DataTemplate local:MainPage}"/>
        </Tab>
        <Tab Title="Tab2" 
             >
            <ShellContent ContentTemplate="{DataTemplate local:MainPage}"/>
        </Tab>
    </TabBar>
  1. Run the app on an Android (Tested on Pixel 5 Emulator API 33, Samsung S21 Ultra 5G API 33).
  2. Switch tabs to the other one.
  3. Send the app to the background.
  4. Open the app using the drawer icon (Not from running apps).
  5. Switch tabs (Exception is thrown).

Link to public reproduction project repository

https://github.com/Adelzu/DOTNET_MAUI_NULLREFEXCEP

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

Android 13

Did you find any workaround?

No workaround found yet.

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-controls-shellShell Navigation, Routes, Tabs, Flyoutplatform/android 🤖s/triagedIssue has been revieweds/try-latest-versionPlease try to reproduce the potential issue on the latest public versiont/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions