{"record":{"id":"1392c6d95c3c84c8","repo":"dotnet/maui","slug":"could-not-find-or-create-a-renderer-for-the-page","errorCode":null,"errorMessage":"Could not find or create a renderer for the Page {page}","messagePattern":"Could not find or create a renderer for the Page (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Compatibility/Core/src/Windows/PageExtensions.cs","lineNumber":38,"sourceCode":"\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}\n\t}\n\n\t[System.Obsolete]\n\tpublic static class PageExtensions\n\t{\n\t\tpublic static FrameworkElement CreateFrameworkElement(this ContentPage contentPage)\n\t\t{\n\t\t\treturn contentPage.ToFrameworkElement();\n\t\t}\n\n\t\tinternal static FrameworkElement ToFrameworkElement(this VisualElement visualElement)\n\t\t{\n\t\t\tif (!Forms.IsInitialized)\n\t\t\t{","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/Windows/PageExtensions.cs#L20-L56","documentation":"Thrown as InvalidOperationException by FormsEmbeddedPageWrapper.OnNavigatedTo when page.CreateFrameworkElement() returns null. This means no renderer could be found or created for the ContentPage. The renderer infrastructure (Registrar) must have a handler registered for the page's type, and Forms must be initialized.","triggerScenarios":"Calling CreateFrameworkElement on a page whose renderer type is not registered with the Registrar, or when Forms initialization is incomplete so GetOrCreateRenderer returns null.","commonSituations":"Using a custom Page subclass without a corresponding ExportRenderer attribute; calling embedding APIs before all renderer assemblies have been registered via Forms.Init; or assembly stripping/removing the renderer during build.","solutions":["Add an ExportRenderer attribute mapping the custom Page type to its renderer.","Call Forms.Init() with all required renderer assemblies before embedding pages.","Verify the page type is not stripped by linker/trimming settings."],"exampleFix":"// before — CustomPage has no renderer registered\nFormsEmbeddedPageWrapper.Pages[guid] = new CustomPage();\nFrame.Navigate(typeof(FormsEmbeddedPageWrapper), guid);\n\n// after\n[assembly: ExportRenderer(typeof(CustomPage), typeof(CustomPageRenderer))]\n// and ensure Forms.Init includes the assembly","handlingStrategy":"validation","validationCode":"if (Forms.IsInitialized && Registrar.Registered.GetHandlerForObject<IVisualElementRenderer>(page) != null)\n    var fe = page.CreateFrameworkElement();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register all custom Page renderers via ExportRenderer attributes.","Ensure Forms.Init() runs with the correct assembly list before embedding pages.","Check linker/trimmer settings don't strip renderer types."],"tags":["wpf","maui-compatibility","embedded","renderer-registration","page-extensions"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}