{"record":{"id":"572c16078b237332","repo":"dotnet/maui","slug":"cannot-navigate-to-formsembeddedpagewrapper-withou","errorCode":null,"errorMessage":"Cannot navigate to FormsEmbeddedPageWrapper without providing a Page identifier.","messagePattern":"Cannot navigate to FormsEmbeddedPageWrapper without providing a Page identifier\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Compatibility/Core/src/Windows/PageExtensions.cs","lineNumber":24,"sourceCode":"\nnamespace Microsoft.Maui.Controls.Compatibility.Platform.UWP\n{\n\tpublic sealed partial class FormsEmbeddedPageWrapper : Microsoft.UI.Xaml.Controls.Page\n\t{\n\t\tinternal static Dictionary<Guid, ContentPage> Pages = new Dictionary<Guid, ContentPage>();\n\n\t\tpublic FormsEmbeddedPageWrapper()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\n\t\tprotected override void OnNavigatedTo(Microsoft.UI.Xaml.Navigation.NavigationEventArgs e)\n\t\t{\n\t\t\tbase.OnNavigatedTo(e);\n\n\t\t\tif (e.Parameter == null)\n\t\t\t{\n\t\t\t\tthrow new InvalidOperationException($\"Cannot navigate to {nameof(FormsEmbeddedPageWrapper)} without \"\n\t\t\t\t\t+ $\"providing a {nameof(Microsoft.Maui.Controls.Page)} identifier.\");\n\t\t\t}\n\n\t\t\t// Find the page instance in the dictionary and then discard it so we don't prevent it from being collected\n\t\t\tvar key = (Guid)e.Parameter;\n\t\t\tvar page = Pages[key];\n\t\t\tPages.Remove(key);\n\n\t\t\t// Convert that page into a FrameWorkElement we can display in the ContentPresenter\n\t\t\tFrameworkElement frameworkElement = page.CreateFrameworkElement();\n\n\t\t\tif (frameworkElement == null)\n\t\t\t{\n\t\t\t\tthrow new InvalidOperationException($\"Could not find or create a renderer for the Page {page}\");\n\t\t\t}\n\n\t\t\tRoot.Content = frameworkElement;\n\t\t}","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/Windows/PageExtensions.cs#L6-L42","documentation":"Thrown as InvalidOperationException by FormsEmbeddedPageWrapper.OnNavigatedTo when the navigation parameter (e.Parameter) is null. FormsEmbeddedPageWrapper expects a Guid identifier that maps to a ContentPage in its internal Pages dictionary; navigating without a parameter means there is no page to display.","triggerScenarios":"Navigating to FormsEmbeddedPageWrapper via Frame.Navigate(typeof(FormsEmbeddedPageWrapper)) without passing a Guid parameter, or when the navigation event args have a null Parameter.","commonSituations":"Calling Frame.Navigate without the second argument; a navigation redirect that strips parameters; or using a navigation template that doesn't forward the Guid.","solutions":["Always pass a Guid when navigating: Frame.Navigate(typeof(FormsEmbeddedPageWrapper), guid).","Register the ContentPage in FormsEmbeddedPageWrapper.Pages[guid] = page before navigating with that guid.","Ensure no middleware or navigation interceptors strip the parameter."],"exampleFix":"// before\nFrame.Navigate(typeof(FormsEmbeddedPageWrapper));\n\n// after\nvar guid = Guid.NewGuid();\nFormsEmbeddedPageWrapper.Pages[guid] = contentPage;\nFrame.Navigate(typeof(FormsEmbeddedPageWrapper), guid);","handlingStrategy":"validation","validationCode":"if (e.Parameter != null && e.Parameter is Guid)\n    // safe to proceed with navigation\nelse\n    // navigate away or show error","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a Guid as the second argument to Frame.Navigate for FormsEmbeddedPageWrapper.","Register the ContentPage in the Pages dictionary under that Guid before navigating."],"tags":["wpf","maui-compatibility","embedded","navigation","page-extensions"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}