{"record":{"id":"80f17138742da402","repo":"dotnet/wpf","slug":"sr-noforwardentry","errorCode":null,"errorMessage":"SR.NoForwardEntry","messagePattern":"SR\\.NoForwardEntry","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/JournalNavigationScope.cs","lineNumber":182,"sourceCode":"            {\n                _host.VerifyContextAndObjectState();\n                return _journal != null && !InAppShutdown && _journal.CanGoForward;\n            }\n        }\n        public bool CanGoBack\n        {\n            get\n            {\n                _host.VerifyContextAndObjectState();\n                return _journal != null && !InAppShutdown && _journal.CanGoBack;\n            }\n        }\n\n        public void GoForward()\n        {\n            // CanGoForward checks the calling thread and InAppShutdown as well\n            if (!CanGoForward)\n                throw new InvalidOperationException(SR.NoForwardEntry);\n\n            if (!_host.GoForwardOverride())\n            {\n                JournalEntry je = Journal.BeginForwardNavigation();\n                // If je is null it indicates that we are going going \"forward\" to the currently\n                // displayed page which has no journal entry. The comment in BeginForwardNavigation\n                // explains how this can happen.\n                if (je == null)\n                {\n                    _rootNavSvc.StopLoading();\n                    return;\n                }\n                NavigateToEntry(je);\n                // NavigateToEntry() should call AbortJournalNavigation() if navigation is canceled.\n            }\n        }\n\n        public void GoBack()","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/JournalNavigationScope.cs#L164-L200","documentation":"JournalNavigationScope.GoForward navigates forward in the WPF journal. It throws InvalidOperationException('no forward entry') when CanGoForward is false — the forward journal stack is empty, the call comes off the UI thread, or the application is already shut down. There is no journal entry to navigate to.","triggerScenarios":"Calling GoForward() when CanGoForward is false: empty forward stack, calling from a non-UI thread, or after in-application shutdown.","commonSituations":"Custom navigation buttons wired to GoForward without checking CanGoForward; calling navigation methods after the window/frame closed; invoking from background threads.","solutions":["Check NavigationWindow/Frame.CanGoForward (or the scope's CanGoForward) before calling GoForward.","Ensure navigation calls run on the UI Dispatcher thread.","Subscribe to CanGoForward changed notifications to enable/disable UI navigation buttons instead of calling unconditionally.","Wrap in try-catch for InvalidOperationException if state can race."],"exampleFix":"// before\njournalScope.GoForward();\n// after\nif (journalScope.CanGoForward)\n    journalScope.GoForward();","handlingStrategy":"validation","validationCode":"if (journalScope.CanGoForward)\n    journalScope.GoForward();","typeGuard":null,"tryCatchPattern":"try\n{\n    journalScope.GoForward();\n}\ncatch (InvalidOperationException)\n{\n    // forward navigation unavailable; update UI state\n}","preventionTips":["Bind navigation button IsEnabled to CanGoForward","Invoke navigation only on the UI thread","Check InAppShutdown state before navigation","Use NavigationService events to sync UI state"],"tags":["wpf","navigation","journal","invalid-state"],"backgroundTag":"invalid-state-transition","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}