Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page with TitleView crashes on Android when navigating back to it from Shell Tab #4506

Closed
alwynlombaard opened this issue Feb 4, 2022 · 4 comments · Fixed by #5667
Closed
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-6.0.300-rc.2 Look for this fix in 6.0.300-rc.2! platform/android 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@alwynlombaard
Copy link

alwynlombaard commented Feb 4, 2022

Description

Project to reproduce issue: https://github.com/alwynlombaard/maui-shell-titleview-android-crash

An App Shell with two Tabs with one of the Tab Content Pages containing a Shell.TitleView causes a crash on Android when navigating to another Tab and back to the Tab that contains the Shell.TitleView with the following from the log on Android:

02-04 08:55:10.322  8890  8890 I MonoDroid: UNHANDLED EXCEPTION:
02-04 08:55:10.348  8890  8890 I MonoDroid: Java.Lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Java.Interop.JniEnvironment.InstanceMethods.CallNonvirtualVoidMethod(JniObjectReference instance, JniObjectReference type, JniMethodInfo method, JniArgumentValue* args)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Android.Views.ViewGroup.AddView(View child)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.LayoutViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Platform.ElementExtensions.ToNative(IElement view, IMauiContext context)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContentView.OnViewSet(View view)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContentView.set_View(View value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContentView..ctor(Context context, View view, IMauiContext mauiContext)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContainerView.OnViewSet(View view)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContainerView.set_View(View value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContainerView..ctor(Context context, View view, IMauiContext mauiContext)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellToolbarTracker.UpdateTitleView(Context context, Toolbar toolbar, View titleView)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellToolbarTracker.UpdateTitleView()
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellToolbarTracker.OnPageChanged(Page oldPage, Page newPage)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellToolbarTracker.set_Page(Page value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellSectionView.OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState)
02-04 08:55:10.349  8890  8890 I MonoDroid:   --- End of managed Java.Lang.IllegalStateException stack trace ---
02-04 08:55:10.349  8890  8890 I MonoDroid: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addViewInner(ViewGroup.java:5235)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:5064)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:5004)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:4976)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at crc64338477404e88479c.ShellSectionView.n_onCreateView(Native Method)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at crc64338477404e88479c.ShellSectionView.onCreateView(ShellSectionView.java:42)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.os.Handler.handleCallback(Handler.java:938)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.os.Looper.loop(Looper.java:223)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at java.lang.reflect.Method.invoke(Native Method)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
02-04 08:55:10.350  8890  8890 I MonoDroid: 
02-04 08:55:10.350  8890  8890 I MonoDroid:   --- End of managed Java.Lang.IllegalStateException stack trace ---
02-04 08:55:10.350  8890  8890 I MonoDroid: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addViewInner(ViewGroup.java:5235)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:5064)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:5004)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:4976)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at crc64338477404e88479c.ShellSectionView.n_onCreateView(Native Method)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at crc64338477404e88479c.ShellSectionView.onCreateView(ShellSectionView.java:42)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.os.Handler.handleCallback(Handler.java:938)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.os.Looper.loop(Looper.java:223)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
02-04 08:55:10.351  8890  8890 I MonoDroid: 	at java.lang.reflect.Method.invoke(Native Method)
02-04 08:55:10.351  8890  8890 I MonoDroid: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
02-04 08:55:10.351  8890  8890 I MonoDroid: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
02-04 08:55:10.351  8890  8890 I MonoDroid: 
02-04 08:55:10.357   529  8933 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
02-04 08:55:10.357   529  2149 W ActivityTaskManager:   Force finishing activity com.companyname.titleviewtestapp/crc6478eb02fbad93c8d6.MainActivity

Steps to Reproduce

New maui project (reproduction project here: https://github.com/alwynlombaard/maui-shell-titleview-android-crash)

  1. dotnet new maui
  2. Add two content pages
  3. Add AppShell with two tabs
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:titleviewtestapp"
    x:Class="titleviewtestapp.AppShell"
    x:Name="shell"
    BackgroundColor="White">

<FlyoutItem Title="MainPageGroup" 
                Route="MainPageGroup"
                FlyoutItemIsVisible="False">
        <ShellContent Route="MainPage" 
                      Title="MainPage"
                      ContentTemplate="{DataTemplate local:MainPage}">
        </ShellContent>

        <ShellContent Route="SecondaryPage"
                    Title="SecondaryPage"
                    ContentTemplate="{DataTemplate local:SecondaryPage}">
        </ShellContent>
    </FlyoutItem>

</Shell>
  1. Add Shell.TitleView to one tab Content Pages
 <Shell.TitleView>
        <Grid BackgroundColor="Red">
            <Label Text="Title view" VerticalOptions="Center" HorizontalOptions="Start"/>
            <Image Source="dotnet_bot.png" 
                HorizontalOptions="Center"
                VerticalOptions="Center"
                HeightRequest="50" 
                WidthRequest="50"/>
        </Grid>
    </Shell.TitleView>
  1. Run app on Android
  2. Select SecondaryPage Tab
  3. Select MainPage Tab

Version with bug

Preview 12 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

No

Relevant log output

02-04 08:55:10.322  8890  8890 I MonoDroid: UNHANDLED EXCEPTION:
02-04 08:55:10.348  8890  8890 I MonoDroid: Java.Lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Java.Interop.JniEnvironment.InstanceMethods.CallNonvirtualVoidMethod(JniObjectReference instance, JniObjectReference type, JniMethodInfo method, JniArgumentValue* args)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Android.Views.ViewGroup.AddView(View child)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.LayoutViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Platform.ElementExtensions.ToNative(IElement view, IMauiContext context)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContentView.OnViewSet(View view)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContentView.set_View(View value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContentView..ctor(Context context, View view, IMauiContext mauiContext)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContainerView.OnViewSet(View view)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContainerView.set_View(View value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellContainerView..ctor(Context context, View view, IMauiContext mauiContext)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellToolbarTracker.UpdateTitleView(Context context, Toolbar toolbar, View titleView)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellToolbarTracker.UpdateTitleView()
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellToolbarTracker.OnPageChanged(Page oldPage, Page newPage)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellToolbarTracker.set_Page(Page value)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at Microsoft.Maui.Controls.Platform.ShellSectionView.OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
02-04 08:55:10.348  8890  8890 I MonoDroid:    at AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState)
02-04 08:55:10.349  8890  8890 I MonoDroid:   --- End of managed Java.Lang.IllegalStateException stack trace ---
02-04 08:55:10.349  8890  8890 I MonoDroid: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addViewInner(ViewGroup.java:5235)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:5064)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:5004)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:4976)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at crc64338477404e88479c.ShellSectionView.n_onCreateView(Native Method)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at crc64338477404e88479c.ShellSectionView.onCreateView(ShellSectionView.java:42)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.os.Handler.handleCallback(Handler.java:938)
02-04 08:55:10.349  8890  8890 I MonoDroid: 	at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.os.Looper.loop(Looper.java:223)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at java.lang.reflect.Method.invoke(Native Method)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
02-04 08:55:10.350  8890  8890 I MonoDroid: 
02-04 08:55:10.350  8890  8890 I MonoDroid:   --- End of managed Java.Lang.IllegalStateException stack trace ---
02-04 08:55:10.350  8890  8890 I MonoDroid: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addViewInner(ViewGroup.java:5235)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:5064)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:5004)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.view.ViewGroup.addView(ViewGroup.java:4976)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at crc64338477404e88479c.ShellSectionView.n_onCreateView(Native Method)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at crc64338477404e88479c.ShellSectionView.onCreateView(ShellSectionView.java:42)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.os.Handler.handleCallback(Handler.java:938)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.os.Looper.loop(Looper.java:223)
02-04 08:55:10.350  8890  8890 I MonoDroid: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
02-04 08:55:10.351  8890  8890 I MonoDroid: 	at java.lang.reflect.Method.invoke(Native Method)
02-04 08:55:10.351  8890  8890 I MonoDroid: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
02-04 08:55:10.351  8890  8890 I MonoDroid: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
02-04 08:55:10.351  8890  8890 I MonoDroid: 
02-04 08:55:10.357   529  8933 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
02-04 08:55:10.357   529  2149 W ActivityTaskManager:   Force finishing activity com.companyname.titleviewtestapp/crc6478eb02fbad93c8d6.MainActivity
@alwynlombaard alwynlombaard added the t/bug Something isn't working label Feb 4, 2022
@Eilon Eilon added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Feb 10, 2022
@dev-thinks
Copy link

Fix is much appreciated in next preview. thank you.

@kristinx0211 kristinx0211 added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Mar 1, 2022
@kristinx0211
Copy link

verified repro on Android 11, repro sample:
#4506.zip

@ddavid-son
Copy link

I have encountered it myself, just to be more specific, the error occurs when there is a layout(i.e Grid/StackLayout) inside the title view, and removing them seems to bypass the problem although this is not a sufficient solution.

@alwynlombaard
Copy link
Author

I have found a temporary workaround. In OnAppearring I unset it and set it again. For example in my common BasePage class:

protected override void OnAppearing()
{
    base.OnAppearing();

    Shell.SetTitleView(this, null);

    var logo = new Image{
        Source = "logo.png"
    };
    
    var grid = new Grid();
    grid.Add(logo);

    Shell.SetTitleView(this, grid);
}

@PureWeen PureWeen added this to the 6.0.300-rc.2 milestone Mar 22, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 1, 2022
@samhouts samhouts added the fixed-in-6.0.300-rc.2 Look for this fix in 6.0.300-rc.2! label Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-6.0.300-rc.2 Look for this fix in 6.0.300-rc.2! platform/android 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants