{"record":{"id":"f52bb5864259400c","repo":"dotnet/maui","slug":"detail-must-be-set-before-using-a-flyoutpage","errorCode":null,"errorMessage":"Detail must be set before using a FlyoutPage","messagePattern":"Detail must be set before using a FlyoutPage","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Core/FlyoutPage/FlyoutPage.cs","lineNumber":166,"sourceCode":"\t\t}\n\n\t\t/// <summary>Gets or sets a value that indicates how the flyout page displays on the screen. This is a bindable property.</summary>\n\t\tpublic FlyoutLayoutBehavior FlyoutLayoutBehavior\n\t\t{\n\t\t\tget { return (FlyoutLayoutBehavior)GetValue(FlyoutLayoutBehaviorProperty); }\n\t\t\tset { SetValue(FlyoutLayoutBehaviorProperty, value); }\n\t\t}\n\n\t\tbool IFlyoutPageController.CanChangeIsPresented { get; set; } = true;\n\n\t\tRect IFlyoutPageController.DetailBounds\n\t\t{\n\t\t\tget { return _detailBounds; }\n\t\t\tset\n\t\t\t{\n\t\t\t\t_detailBounds = value;\n\t\t\t\tif (_detail == null)\n\t\t\t\t\tthrow new InvalidOperationException(\"Detail must be set before using a FlyoutPage\");\n\t\t\t}\n\t\t}\n\n\t\tRect IFlyoutPageController.FlyoutBounds\n\t\t{\n\t\t\tget { return _flyoutBounds; }\n\t\t\tset\n\t\t\t{\n\t\t\t\t_flyoutBounds = value;\n\t\t\t\tif (_flyout == null)\n\t\t\t\t\tthrow new InvalidOperationException(\"Flyout must be set before using a FlyoutPage\");\n\t\t\t}\n\t\t}\n\n\t\tbool IFlyoutPageController.ShouldShowSplitMode\n\t\t{\n\t\t\tget\n\t\t\t{","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Core/FlyoutPage/FlyoutPage.cs#L148-L184","documentation":"The IFlyoutPageController.DetailBounds setter throws InvalidOperationException when the platform renderer reports detail layout bounds but the Detail page was never assigned. Renderers (PhoneFlyoutPageRenderer, TabletFlyoutPageRenderer, FlyoutPageRenderer) push measured rects during layout; if Detail is null the layout pass has nowhere to apply them, indicating incomplete page setup.","triggerScenarios":"A FlyoutPage is added to the visual tree and laid out by the platform renderer before its Detail property is set. Casting to IFlyoutPageController and setting DetailBounds directly in custom renderer code with Detail still null.","commonSituations":"Constructing a FlyoutPage and navigating to it before setting Detail (e.g., setting Flyout but forgetting Detail), or a custom renderer that sets bounds eagerly during OnLayout.","solutions":["Always set both Flyout and Detail before the page is pushed onto a NavigationPage or set as the MainPage.","If writing a custom renderer, guard DetailBounds assignment with a null check on Detail or wait for both pages to be present.","Construct the FlyoutPage via a factory that guarantees both children are set."],"exampleFix":"// before\nMainPage = new FlyoutPage { Flyout = menu };\n// later renderer sets DetailBounds -> throws\n\n// after\nMainPage = new FlyoutPage { Flyout = menu, Detail = detail };","handlingStrategy":"validation","validationCode":"if (flyoutPage.Detail is null) throw new InvalidOperationException(\"Set Detail before layout\");","typeGuard":"static bool IsFlyoutPageReady(FlyoutPage p) => p.Flyout is not null && p.Detail is not null;","tryCatchPattern":null,"preventionTips":["Set both Flyout and Detail before the page enters the visual tree.","In custom renderers, guard DetailBounds assignment against a null Detail.","Use a factory that enforces both children are present."],"tags":["maui","flyoutpage","renderers","layout"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}