{"record":{"id":"90cc90019317ec43","repo":"unoplatform/uno","slug":"failed-to-load-e-sourcepagetype-fullname-e-exc-90cc90","errorCode":null,"errorMessage":"Failed to load {e.SourcePageType.FullName}: {e.Exception}","messagePattern":"Failed to load (.+?): (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/SolutionTemplate/5.6/uno56net9win32/uno56net9win32/App.xaml.cs","lineNumber":61,"sourceCode":"            // When the navigation stack isn't restored navigate to the first page,\n            // configuring the new page by passing required information as a navigation\n            // parameter\n            rootFrame.Navigate(typeof(MainPage), args.Arguments);\n        }\n\n        MainWindow.SetWindowIcon();\n        // Ensure the current window is active\n        MainWindow.Activate();\n    }\n\n    /// <summary>\n    /// Invoked when Navigation to a certain page fails\n    /// </summary>\n    /// <param name=\"sender\">The Frame which failed navigation</param>\n    /// <param name=\"e\">Details about the navigation failure</param>\n    void OnNavigationFailed(object sender, NavigationFailedEventArgs e)\n    {\n        throw new InvalidOperationException($\"Failed to load {e.SourcePageType.FullName}: {e.Exception}\");\n    }\n\n    /// <summary>\n    /// Configures global Uno Platform logging\n    /// </summary>\n    public static void InitializeLogging()\n    {\n#if DEBUG\n        // Logging is disabled by default for release builds, as it incurs a significant\n        // initialization cost from Microsoft.Extensions.Logging setup. If startup performance\n        // is a concern for your application, keep this disabled. If you're running on the web or\n        // desktop targets, you can use URL or command line parameters to enable it.\n        //\n        // For more performance documentation: https://platform.uno/docs/articles/Uno-UI-Performance.html\n\n        var factory = LoggerFactory.Create(builder =>\n        {\n#if __WASM__","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SolutionTemplate/5.6/uno56net9win32/uno56net9win32/App.xaml.cs#L43-L79","documentation":"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.","triggerScenarios":"Frame.Navigate to a page whose constructor/XAML throws, or to a type that cannot be activated on the net9 Win32 desktop target.","commonSituations":"Page constructor null reference (missing DI service), XAML resource that fails to resolve, x:Class mismatch, or desktop-only code path that throws.","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."],"exampleFix":"// before\nvoid OnNavigationFailed(object sender, NavigationFailedEventArgs e)\n{\n    throw new InvalidOperationException($\"Failed to load {e.SourcePageType.FullName}: {e.Exception}\");\n}\n\n// after\nvoid OnNavigationFailed(object sender, NavigationFailedEventArgs e)\n{\n    _logger.LogError(e.Exception, \"Nav failed: {Page}\", e.SourcePageType?.FullName);\n    e.Handled = true;\n}","handlingStrategy":"try-catch","validationCode":"static bool CanNavigate(Frame f, Type page) => page != null && f.Content?.GetType() != page;","typeGuard":null,"tryCatchPattern":"try { frame.Navigate(pageType); } catch (InvalidOperationException) { log.Error($\"Desktop nav failed: {pageType}\"); frame.Navigate(typeof(ErrorPage)); }","preventionTips":["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."],"tags":["navigation","uno-template","frame","desktop","boilerplate"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}