PrismLibrary/Prism · error · NavigationException
NavigationException.ErrorCreatingPage
NavigationException.ErrorCreatingPage
Error message
NavigationException.ErrorCreatingPage
What it means
This is the generic fallback in CreatePage: an exception occurred while instantiating the Page for a segment and it was not a NavigationException, KeyNotFoundException, ViewModelCreationException, or the dispatcher-thread case. Prism wraps it as NavigationException.ErrorCreatingPage with the segment name and original exception as InnerException.
Solutions
- Inspect the InnerException (the original ex) for the real cause and fix that
- Check the page's constructor and XAML for throwing code and missing resources/converters
- Register any services used in the page constructor so construction completes
Example fix
// before
public ViewBPage() { InitializeComponent(); LoadConfig(); // throws off main path
// after
public ViewBPage() { InitializeComponent(); }
protected override void OnNavigatedTo(INavigationParameters p) { SafeLoadConfig(); } Defensive patterns
Strategy: try-catch
Try / catch
try { await _navigationService.NavigateAsync(segment); }
catch (NavigationException ne) when (ne.Message == NavigationException.ErrorCreatingPage)
{ Log(ne.InnerException); ShowFallbackPage(); } Prevention
- Keep page constructors trivial; defer work to OnNavigatedTo/OnAppearing
- Validate XAML resources (converters, styles, images) at build/preview time
- Test navigation to every page once in a smoke test
When it happens
Trigger: A Page's constructor or XAML load throws (missing resource/image, StaticResource key not found, x:Static failure, ctor exception); any non-registered exception type bubbling out of Registry.CreateView.
Common situations: XAML referencing a missing namespace, converter, or style; a page constructor throwing (file I/O, null config); version upgrades where a control no longer exists.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- The page type ' ' is not supported.
- Unable to determine the current page.
- NavigationException.NoPageIsRegistered
- The builder does not implement IRegistryAware
- NavigationException.NoPageIsRegistered
AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15).
Data as JSON: /api/errors/bed90ac606ee2026.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/Navigation/PageNavigationService.cs:967
catch(ViewModelCreationException vmce)
{
throw new NavigationException(NavigationException.ErrorCreatingViewModel, segmentName, _pageAccessor.Page, vmce);
}
//catch(ViewCreationException viewCreationException)
//{
// if(!string.IsNullOrEmpty(viewCreationException.InnerException?.Message) && viewCreationException.InnerException.Message.Contains("Maui"))
// throw new NavigationException(NavigationException.)
//}
catch (Exception ex)
{
var inner = ex.InnerException;
while(inner is not null)
{
if (inner.Message.Contains("thread with a dispatcher"))
throw new NavigationException(NavigationException.UnsupportedMauiCreation, segmentName, _pageAccessor.Page, ex);
inner = inner.InnerException;
}
throw new NavigationException(NavigationException.ErrorCreatingPage, segmentName, ex);
}
}
protected virtual Page CreatePageFromSegment(string segment)
{
string segmentName = UriParsingHelper.GetSegmentName(segment);
var page = CreatePage(segmentName);
if (page is null)
{
var innerException = new NullReferenceException(string.Format("{0} could not be created. Please make sure you have registered {0} for navigation.", segmentName));
throw new NavigationException(NavigationException.NoPageIsRegistered, segmentName, _pageAccessor.Page, innerException);
}
return page;
}
async Task ConfigureTabbedPage(TabbedPage tabbedPage, string segment, INavigationParameters parameters)
{View on GitHub (pinned to 358118cd64)