unoplatform/uno · error · InvalidOperationException
Failed to load {e.SourcePageType.FullName}: {e.Exception}
Error message
Failed to load {e.SourcePageType.FullName}: {e.Exception} What it means
Default OnNavigationFailed handler in the Uno 5.6 solution template (uno56droidioswasmskia, multi-target Android/iOS/WASM/Skia). Same as other Uno templates: when Frame navigation to SourcePageType fails, the inner exception is wrapped and re-thrown as InvalidOperationException, crashing the process. Fail-fast design for development.
Source
Thrown at src/SolutionTemplate/5.6/uno56droidioswasmskia/uno56droidioswasmskia/App.xaml.cs:61
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), args.Arguments);
}
MainWindow.SetWindowIcon();
// Ensure the current window is active
MainWindow.Activate();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new InvalidOperationException($"Failed to load {e.SourcePageType.FullName}: {e.Exception}");
}
/// <summary>
/// Configures global Uno Platform logging
/// </summary>
public static void InitializeLogging()
{
#if DEBUG
// Logging is disabled by default for release builds, as it incurs a significant
// initialization cost from Microsoft.Extensions.Logging setup. If startup performance
// is a concern for your application, keep this disabled. If you're running on the web or
// desktop targets, you can use URL or command line parameters to enable it.
//
// For more performance documentation: https://platform.uno/docs/articles/Uno-UI-Performance.html
var factory = LoggerFactory.Create(builder =>
{
#if __WASM__View on GitHub (pinned to 0418340488)
Solutions
- Inspect e.Exception for the real cause; the message's page name is secondary context.
- Test navigation on each target individually to find which platform fails (multi-target template).
- Check the page's #if guards and resource references resolve on every target the project builds.
- Replace the throw with logging and set e.Handled=true to navigate to an error page instead of crashing.
Example fix
// before
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new InvalidOperationException($"Failed to load {e.SourcePageType.FullName}: {e.Exception}");
}
// after
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
_logger.LogError(e.Exception, "Nav failed: {Page}", e.SourcePageType?.FullName);
e.Handled = true;
(sender as Frame)?.Navigate(typeof(ErrorPage));
} Defensive patterns
Strategy: try-catch
Validate before calling
static bool CanNavigate(Frame f, Type page) => page != null && f.Content?.GetType() != page;
Try / catch
try { frame.Navigate(pageType); } catch (InvalidOperationException) { log.Error($"Nav failed on multi-target: {pageType}"); frame.Navigate(typeof(ErrorPage)); } Prevention
- Test navigation on each target (Android/iOS/WASM/Skia) separately.
- Guard platform-specific code in pages with #if and verify resource resolution per target.
- Replace the re-throw with graceful handling for production builds.
When it happens
Trigger: Frame.Navigate to a page that throws during construction/initialization, or a page type not available on one of the four targets (Android/iOS/WASM/Skia).
Common situations: Platform-conditional code path that breaks on one target, missing asset/resource on WASM, page excluded via #if on the active platform, or a constructor dependency not registered in the host.
Related errors
- Failed to load {e.SourcePageType.FullName}: {e.Exception}
- Failed to load {e.SourcePageType.FullName}: {e.Exception}
- Failed to load {e.SourcePageType.FullName}: {e.Exception}
- Failed to load {e.SourcePageType.FullName}: {e.Exception}
- Failed to load {e.SourcePageType.FullName}: {e.Exception}
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/1a755c845be3871a.
Report an issue: GitHub.