{"record":{"id":"bc8773a488340570","repo":"dotnet/maui","slug":"parentingviewcontroller-parent-could-not-be-found","errorCode":null,"errorMessage":"ParentingViewController parent could not be found. Please file a bug.","messagePattern":"ParentingViewController parent could not be found\\. Please file a bug\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"critical","filePath":"src/Compatibility/Core/src/iOS/Renderers/NavigationRenderer.cs","lineNumber":422,"sourceCode":"\t\t}\n\n\t\tvoid FindParentFlyoutPage()\n\t\t{\n\t\t\tvar page = Element as Page;\n\t\t\tvar parentPages = page.GetParentPages();\n\t\t\tvar flyoutDetail = parentPages.OfType<FlyoutPage>().FirstOrDefault();\n\n\t\t\tif (flyoutDetail != null && parentPages.Append((Page)Element).Contains(flyoutDetail.Detail))\n\t\t\t\t_parentFlyoutPage = flyoutDetail;\n\t\t}\n\n\t\tTask<bool> GetAppearedOrDisappearedTask(Page page)\n\t\t{\n\t\t\tvar tcs = new TaskCompletionSource<bool>();\n\n\t\t\tvar parentViewController = Platform.GetRenderer(page).ViewController.ParentViewController as ParentingViewController;\n\t\t\tif (parentViewController == null)\n\t\t\t\tthrow new NotSupportedException(\"ParentingViewController parent could not be found. Please file a bug.\");\n\n\t\t\tEventHandler appearing = null, disappearing = null;\n\t\t\tappearing = (s, e) =>\n\t\t\t{\n\t\t\t\tparentViewController.Appearing -= appearing;\n\t\t\t\tparentViewController.Disappearing -= disappearing;\n\n\t\t\t\tDevice.BeginInvokeOnMainThread(() => { tcs.SetResult(true); });\n\t\t\t};\n\n\t\t\tdisappearing = (s, e) =>\n\t\t\t{\n\t\t\t\tparentViewController.Appearing -= appearing;\n\t\t\t\tparentViewController.Disappearing -= disappearing;\n\n\t\t\t\tDevice.BeginInvokeOnMainThread(() => { tcs.SetResult(false); });\n\t\t\t};\n","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/iOS/Renderers/NavigationRenderer.cs#L404-L440","documentation":"GetAppearedOrDisappearedTask resolves the ParentingViewController that hosts a page's renderer by walking ParentViewController. If the parent chain does not yield a ParentingViewController, the page's lifecycle hooks (Appearing/Disappearing) cannot be wired, so it throws NotSupportedException indicating an internal-state problem (a bug report is requested).","triggerScenarios":"The page's renderer.ViewController.ParentViewController is not a ParentingViewController - e.g. the view controller was reparented into a custom container, the navigation hierarchy was manipulated externally, or a flyout/detail structure changed unexpectedly.","commonSituations":"Embedding a NavigationPage inside a custom UIViewController container; custom presenters; version/compat mismatches after upgrading MAUI; page rendered outside the standard NavigationPage host.","solutions":["Keep pages inside the standard NavigationPage/Page presenter hierarchy.","Avoid reparenting the page's UIViewController externally.","Verify no third-party navigation library intercepts the controller hierarchy.","If using FlyoutPage, ensure Detail is a NavigationPage and not reparented."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep pages within the standard NavigationPage presenter hierarchy.","Avoid external UIViewController reparenting.","Do not let third-party navigation libraries own the controller chain."],"tags":["notsupportedexception","ios","navigation","parentingviewcontroller","internal-bug"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}