Skip to content

Switching to an existing page with SetTitleView used in Flyout menu causes "Element is already the child of another element" crash on Windows in MAUI 8.0.6 #21037

@SmartmanApps

Description

@SmartmanApps

Description

In MAUI 8.0.3, the TitleBar was broken for NavigationPages, but otherwise switching between existing (i.e. not "new" each time) was working. In 8.0.6 the former was fixed but the latter is now broken on Windows. Bug also present in 8.0.7. It still works if...

  • on Android (not tested other platforms)
  • if you create a new page each time (which defeats the purpose of using a Flyout menu)
  • if you use "Title=" instead of NavigationPage.SetTitleView
  • in 8.0.3
    But not if you've used SetTitleView on an existing page in Windows with 8.0.6-7.

Note: the repro repo is the same one as I used for 15767, which is still not fixed (I added the new code in a new branch).

Steps to Reproduce

  1. create a new MAUI app with a Flyout menu, which has at least 1 page in it which is only created once.
  2. use SetTitleView on at least one of those such pages.
  3. that page(s) will work the first time you switch to it, but when you switch to another page and then switch back to it the crash occurs on Windows.
  4. the code for all this is in the 806issue branch of the FlyoutRepro repo. You can change the commnted-out lines on both TemplateFlyoutPage.cs and SecondPage.cs to change the various configs (currently set to it's crashing state of using SetTitleView and only creating the page once). I have some //// comments just before those lines you can change (so just search for ////).

Link to public reproduction project repository

https://github.com/SmartmanApps/FlyoutRepro

Version with bug

8.0.6 SR1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.3 GA

Affected platforms

Windows

Affected platform versions

1000.19041.1000.0

Did you find any workaround?

See description - changing any one of the 4 factors (existing page, Windows, SetTitleView, 8.0.6) works, just not those 4 things together.

Relevant log output

Exception thrown: 'System.Runtime.InteropServices.COMException' in WinRT.Runtime.dll
WinRT information: Element is already the child of another element.
'FlyoutRepro.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.2\System.Diagnostics.StackTrace.dll'. 
'FlyoutRepro.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.2\System.Reflection.Metadata.dll'. 
'FlyoutRepro.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.2\System.Collections.Immutable.dll'. 
********************************** UNHANDLED EXCEPTION! Details: System.Runtime.InteropServices.COMException (0x800F1000): No installed components were detected.

Element is already the child of another element.
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|39_0(Int32 hr)
The program '[23644] FlyoutRepro.exe' has exited with code 4294967295 (0xffffffff).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-titleviewTitleViewi/regressionThis issue described a confirmed regression on a currently supported versionpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/windowss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions