{"record":{"id":"8556f36632173f0b","repo":"dotnet/maui","slug":"pushasync-is-not-supported-globally-on-windows-pl-8556f3","errorCode":null,"errorMessage":"PushAsync is not supported globally on Windows, please use a NavigationPage.","messagePattern":"PushAsync is not supported globally on Windows, please use a NavigationPage\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Compatibility/Core/src/Windows/Platform.cs","lineNumber":212,"sourceCode":"\n\t\tTask INavigation.PushAsync(Page root)\n\t\t{\n\t\t\treturn ((INavigation)this).PushAsync(root, true);\n\t\t}\n\n\t\tTask<Page> INavigation.PopAsync()\n\t\t{\n\t\t\treturn ((INavigation)this).PopAsync(true);\n\t\t}\n\n\t\tTask INavigation.PopToRootAsync()\n\t\t{\n\t\t\treturn ((INavigation)this).PopToRootAsync(true);\n\t\t}\n\n\t\tTask INavigation.PushAsync(Page root, bool animated)\n\t\t{\n\t\t\tthrow new InvalidOperationException(\"PushAsync is not supported globally on Windows, please use a NavigationPage.\");\n\t\t}\n\n\t\tTask<Page> INavigation.PopAsync(bool animated)\n\t\t{\n\t\t\tthrow new InvalidOperationException(\"PopAsync is not supported globally on Windows, please use a NavigationPage.\");\n\t\t}\n\n\t\tTask INavigation.PopToRootAsync(bool animated)\n\t\t{\n\t\t\tthrow new InvalidOperationException(\n\t\t\t\t\"PopToRootAsync is not supported globally on Windows, please use a NavigationPage.\");\n\t\t}\n\n\t\tvoid INavigation.RemovePage(Page page)\n\t\t{\n\t\t\tthrow new InvalidOperationException(\"RemovePage is not supported globally on Windows, please use a NavigationPage.\");\n\t\t}\n","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/Windows/Platform.cs#L194-L230","documentation":"The Windows Platform class implements INavigation explicitly, but PushAsync throws unconditionally. Global (non-NavigationPage) page-stack navigation is unsupported on WinUI/UWP — only a NavigationPage host provides the navigation stack. The Platform class is the fallback INavigation when MainPage is not a NavigationPage.","triggerScenarios":"Calling Application.Current.MainPage.Navigation.PushAsync(page) when MainPage is a plain ContentPage, FlyoutPage, or TabbedPage rather than a NavigationPage. The Navigation property resolves to the global Platform INavigation instance, which rejects stack operations.","commonSituations":"Cross-platform shared code where iOS/Android support global navigation but Windows does not; porting from Xamarin.Forms where this difference was not handled; assuming Navigation works uniformly across platforms.","solutions":["Wrap the root page in a NavigationPage: MainPage = new NavigationPage(new MyContentPage())","Access navigation through the NavigationPage's own Navigation property instead of the global one","Use PushModalAsync which IS supported on the global Platform instance","Abstract navigation behind an interface with platform-specific implementations"],"exampleFix":"// before\nMainPage = new MyContentPage();\nMainPage.Navigation.PushAsync(new DetailPage()); // throws on Windows\n\n// after\nMainPage = new NavigationPage(new MyContentPage());\nMainPage.Navigation.PushAsync(new DetailPage()); // works","handlingStrategy":"validation","validationCode":"// Before calling PushAsync, verify NavigationPage is the host\nif (Application.Current.MainPage is NavigationPage navPage)\n{\n    await navPage.Navigation.PushAsync(newPage);\n}\nelse if (Device.RuntimePlatform == Device.WinUI || Device.RuntimePlatform == Device.UWP)\n{\n    // Windows requires NavigationPage for stack navigation\n    Application.Current.MainPage = new NavigationPage(Application.Current.MainPage);\n    await Application.Current.MainPage.Navigation.PushAsync(newPage);\n}","typeGuard":"static bool HasNavigationPageSupport()\n{\n    return Application.Current.MainPage is NavigationPage;\n}","tryCatchPattern":null,"preventionTips":["Always wrap root pages in NavigationPage: MainPage = new NavigationPage(rootPage)","Abstract navigation behind a service interface with platform-specific implementations","Test navigation flows on Windows early in development"],"tags":["navigation","winui","uwp","maui-compatibility","platform-limitation"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}