{"record":{"id":"a42f636212b8d1dc","repo":"unoplatform/uno","slug":"failed-to-load-e-sourcepagetype-fullname-e-exc-a42f63","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/uno56netcurrent/uno56netcurrent/App.xaml.cs","lineNumber":70,"sourceCode":"        MainWindow.SetWindowIcon();\n        // Ensure the current window is active\n        MainWindow.Activate();\n\n        if (exitAfterLaunching)\n        {\n            await Task.Delay(1000);\n            Exit();\n        }\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        // Logging must be enabled for all build configurations so that `.AddFakeLogging()` can be used to\n        // catch binding errors in test and production builds.\n        //\n        // Performance is not a concern here.  This is an integration test.\n\n        var factory = LoggerFactory.Create(builder =>\n        {\n#if __WASM__\n            builder.AddProvider(new global::Uno.Extensions.Logging.WebAssembly.WebAssemblyConsoleLoggerProvider());\n#elif __IOS__\n            builder.AddProvider(new global::Uno.Extensions.Logging.OSLogLoggerProvider());","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SolutionTemplate/5.6/uno56netcurrent/uno56netcurrent/App.xaml.cs#L52-L88","documentation":"Default OnNavigationFailed handler in the Uno 5.6 solution template (uno56netcurrent, integration-test app). Behaves like all Uno templates: when Frame navigation to SourcePageType fails, it wraps the inner exception in InvalidOperationException and re-throws, crashing the app. This template intentionally enables logging for all configurations to surface binding errors.","triggerScenarios":"Frame.Navigate to a page that throws during construction/XAML load, or to a type that cannot be activated in the net-current integration-test host.","commonSituations":"Page constructor throws (missing DI registration, null dependency), x:Class mismatch, resource/binding error caught by FakeLogging, or a platform guard excluding the page.","solutions":["Read e.Exception for the true root cause — the wrapped message is only identifying the page.","Use the enabled logging/FakeLogging output in this template to spot binding errors that precede the crash.","Confirm x:Class and project inclusion of the page type for the net-current target.","Replace the throw with diagnostics + e.Handled=true + fallback page for non-crashing behavior."],"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($\"Integration-test nav failed: {pageType}\"); frame.Navigate(typeof(ErrorPage)); }","preventionTips":["Use the template's FakeLogging output to catch binding errors that precede the crash.","Assert page DI registrations in the integration host at startup.","Replace the throw with graceful handling for non-crashing tests."],"tags":["navigation","uno-template","frame","integration-test","boilerplate"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}