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.3 solution template (uno53net9blank). Identical contract to other Uno templates: the Frame raises NavigationFailed when a page cannot be loaded, and the template wraps the inner exception into an InvalidOperationException that re-throws and terminates the app. It exists to make navigation failures impossible to ignore during dev.
Source
Thrown at src/SolutionTemplate/5.3/uno53net9blank/uno53net9blank/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
- Read e.Exception (the inner exception) — it holds the actual failure; the page name in the message is only context.
- Confirm the page type compiles into the active TFM and that x:Class matches the fully-qualified type name.
- Run the page constructor under the debugger to catch the first-chance exception before the wrapper re-throws.
- Swap the throw for diagnostics + e.Handled=true with a fallback page if you need graceful degradation in production.
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, "Navigation failed for {Page}", e.SourcePageType?.FullName);
e.Handled = true;
} 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($"Navigation to {pageType} failed"); frame.Navigate(typeof(ErrorPage)); } Prevention
- Swap the template throw for diagnostics + e.Handled=true.
- Construct target pages in tests before navigating.
- Confirm x:Class/namespace and DI registrations at startup.
When it happens
Trigger: Frame.Navigate to a page whose constructor or XAML initialization throws, or to a type that cannot be activated on the running platform (net9 blank target).
Common situations: Newly added page not wired into the project, x:Class/namespace mismatch, missing dependency injection registration for a page constructor parameter, or a platform guard (#if) excluding the page on the active target.
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/4b76b085fbc9fca7.
Report an issue: GitHub.