{"record":{"id":"4b76b085fbc9fca7","repo":"unoplatform/uno","slug":"failed-to-load-e-sourcepagetype-fullname-e-exc-4b76b0","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.3/uno53net9blank/uno53net9blank/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.3/uno53net9blank/uno53net9blank/App.xaml.cs#L43-L79","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"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, \"Navigation failed for {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($\"Navigation to {pageType} failed\"); frame.Navigate(typeof(ErrorPage)); }","preventionTips":["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."],"tags":["navigation","uno-template","frame","app-lifecycle","boilerplate"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}