{"record":{"id":"197ef4dddf16f195","repo":"dotnet/maui","slug":"pop-is-not-supported-globally-on-windows-please-u","errorCode":null,"errorMessage":"Pop is not supported globally on Windows, please use a LightNavigationPage.","messagePattern":"Pop is not supported globally on Windows, please use a LightNavigationPage\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Compatibility/Core/src/WPF/Interfaces/IFormsNavigation.cs","lineNumber":60,"sourceCode":"\t\t\t\t\treturn System.Windows.Application.Current.MainWindow as FormsWindow;\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tpublic void InsertPageBefore(object page, object before)\n\t\t{\n\t\t\tthrow new InvalidOperationException(\n\t\t\t\t\"InsertPageBefore is not supported globally on Windows, please use a LightNavigationPage.\");\n\t\t}\n\n\t\tpublic void Pop()\n\t\t{\n\t\t\tPop(true);\n\t\t}\n\n\t\tpublic void Pop(bool animated)\n\t\t{\n\t\t\tthrow new InvalidOperationException(\"Pop is not supported globally on Windows, please use a LightNavigationPage.\");\n\t\t}\n\n\t\tpublic void PopModal()\n\t\t{\n\t\t\tPopModal(true);\n\t\t}\n\n\t\tpublic void PopModal(bool animated)\n\t\t{\n\t\t\tParentWindow?.PopModal(animated);\n\t\t}\n\n\t\tpublic void PopToRoot()\n\t\t{\n\t\t\tPopToRoot(true);\n\t\t}\n\n\t\tpublic void PopToRoot(bool animated)","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/WPF/Interfaces/IFormsNavigation.cs#L42-L78","documentation":"IFormsNavigation.Pop (and Pop(bool)) throw InvalidOperationException stating Pop is not supported globally on Windows and instructs to use a LightNavigationPage. The global/window-level navigation proxy intentionally rejects stack pops; only a LightNavigationPage supports them.","triggerScenarios":"Calling Navigation.Pop() or Navigation.PopAsync() against the window-level navigation proxy rather than a LightNavigationPage; shared code path that pops without checking platform.","commonSituations":"Cross-platform code that pops the navigation stack directly; relying on a single Navigation reference that resolves to the window proxy on WPF.","solutions":["Wrap the page in a LightNavigationPage and pop via that instance.","Branch shared navigation logic by platform, using LightNavigationPage on WPF.","Ensure NavigationProxy resolves to the page-level NavigationPage rather than the global FormsWindow.","Provide a platform-specific INavigation implementation for WPF."],"exampleFix":"// before\nawait Navigation.PopAsync();\n\n// after\nif (Navigation is LightNavigationPage lnp)\n    await lnp.PopAsync();","handlingStrategy":"type-guard","validationCode":"if (Navigation is LightNavigationPage lnp) await lnp.PopAsync();\nelse throw new PlatformNotSupportedException(\"Use LightNavigationPage on WPF.\");","typeGuard":"static bool CanPop(NavigationProxy n) => n is LightNavigationPage;","tryCatchPattern":"try { await Navigation.PopAsync(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"LightNavigationPage\"))\n{ /* wrap page in LightNavigationPage, retry */ }","preventionTips":["Use LightNavigationPage for any page stack on WPF.","Branch shared pop logic by Navigation type.","Audit NavigationProxy resolution at startup."],"tags":["wpf","navigation","not-supported","light-navigation-page"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}