PrismLibrary/Prism · error · NavigationException
NavigationException.UnsupportedMauiCreation
NavigationException.UnsupportedMauiCreation
Error message
NavigationException.UnsupportedMauiCreation
What it means
During page creation Prism walks the exception chain and, if any inner exception message contains 'thread with a dispatcher', concludes that a MAUI UI element was created off the UI thread — an unsupported creation pattern — and throws NavigationException.UnsupportedMauiCreation instead of the generic ErrorCreatingPage.
Solutions
- Invoke navigation on the main thread: await MainThread.InvokeOnMainThreadAsync(() => _navigationService.NavigateAsync(...))
- Remove UI element construction from background threads/Task.Run in constructors or OnInitialized
- If in a service/worker, marshal to the dispatcher of the main page (IDispatcherProvider) before navigating
Example fix
// before
Task.Run(() => _navigationService.NavigateAsync("ViewB"));
// after
await MainThread.InvokeOnMainThreadAsync(() => _navigationService.NavigateAsync("ViewB")); Defensive patterns
Strategy: try-catch
Validate before calling
if (!MainThread.IsMainThread) throw new InvalidOperationException("Navigate only on the UI thread"); Try / catch
try { await _navigationService.NavigateAsync(segment); }
catch (NavigationException ne) when (ne.Message == NavigationException.UnsupportedMauiCreation)
{ await MainThread.InvokeOnMainThreadAsync(() => _navigationService.NavigateAsync(segment)); } Prevention
- Never construct Pages or controls on background threads
- Wrap navigation calls in MainThread.InvokeOnMainThreadAsync in services/workers
- Avoid Task.Run around navigation and view creation
When it happens
Trigger: Navigating (creating a Page/ViewModel) from a background thread or Task.Run so a control's constructor touches main-thread-only APIs, surfacing 'thread with a dispatcher' in the inner exception chain.
Common situations: Triggering navigation from an event on a non-UI thread; deep-link handling in a background service; async work that resumes on a non-UI SynchronizationContext and then navigates.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — 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/111e2700ffae6ce8.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/Navigation/PageNavigationService.cs:964
{
throw new NavigationException(NavigationException.NoPageIsRegistered, segmentName, knfe);
}
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;
}View on GitHub (pinned to 358118cd64)