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 (uno56net9win32, net9 Win32/Skia desktop). The Frame raises NavigationFailed on a failed page load; the template wraps e.Exception into InvalidOperationException and re-throws, terminating the app. Intentional fail-fast for development diagnostics.
Source
Thrown at src/SolutionTemplate/5.6/uno56net9win32/uno56net9win32/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
- Examine e.Exception — the inner exception is the real failure; the wrapper message only names the page.
- Validate x:Class and that the page type is compiled into the desktop project.
- Debug the page constructor/OnNavigatedTo to catch the original exception first-chance.
- For production, log the inner exception, set e.Handled=true, and navigate to a fallback page.
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;
} 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($"Desktop nav failed: {pageType}"); frame.Navigate(typeof(ErrorPage)); } Prevention
- Replace the template throw with logging + e.Handled=true on desktop.
- Validate DI registrations and desktop-only code paths in pages.
- Catch page construction in unit tests before wiring navigation.
When it happens
Trigger: Frame.Navigate to a page whose constructor/XAML throws, or to a type that cannot be activated on the net9 Win32 desktop target.
Common situations: Page constructor null reference (missing DI service), XAML resource that fails to resolve, x:Class mismatch, or desktop-only code path that throws.
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/90cc90019317ec43.
Report an issue: GitHub.