{"record":{"id":"e421ab1c4a4637fd","repo":"dotnet/maui","slug":"page-e421ab","errorCode":null,"errorMessage":"page","messagePattern":"page","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Compatibility/Core/src/Windows/Platform.cs","lineNumber":250,"sourceCode":"\t\t{\n\t\t\tthrow new InvalidOperationException(\n\t\t\t\t\"InsertPageBefore is not supported globally on Windows, please use a NavigationPage.\");\n\t\t}\n\n\t\tTask INavigation.PushModalAsync(Page page)\n\t\t{\n\t\t\treturn ((INavigation)this).PushModalAsync(page, true);\n\t\t}\n\n\t\tTask<Page> INavigation.PopModalAsync()\n\t\t{\n\t\t\treturn ((INavigation)this).PopModalAsync(true);\n\t\t}\n\n\t\tTask INavigation.PushModalAsync(Page page, bool animated)\n\t\t{\n\t\t\tif (page == null)\n\t\t\t\tthrow new ArgumentNullException(nameof(page));\n\n\t\t\tvar tcs = new TaskCompletionSource<bool>();\n\t\t\t_navModel.PushModal(page);\n\t\t\tSetCurrent(page, false, true, () => tcs.SetResult(true));\n\t\t\treturn tcs.Task;\n\t\t}\n\n\t\tTask<Page> INavigation.PopModalAsync(bool animated)\n\t\t{\n\t\t\tvar tcs = new TaskCompletionSource<Page>();\n\t\t\tPage result = _navModel.PopModal();\n\t\t\tSetCurrent(_navModel.CurrentPage, true, true, () => tcs.SetResult(result));\n\t\t\treturn tcs.Task;\n\t\t}\n\n\t\tpublic static SizeRequest GetNativeSize(VisualElement element, double widthConstraint, double heightConstraint)\n\t\t{\n\t\t\t// Hack around the fact that Canvas ignores the child constraints.","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/Windows/Platform.cs#L232-L268","documentation":"PushModalAsync on the Windows Platform INavigation throws ArgumentNullException when the page parameter is null. The guard is a simple null check before adding the page to the navigation model via _navModel.PushModal.","triggerScenarios":"Calling Navigation.PushModalAsync(null) or passing a variable that evaluates to null at runtime, such as a factory method result or a deserialized page reference.","commonSituations":"Page factory or resolver returns null under certain conditions; conditional page construction where the page wasn't created; navigation parameter binding resolves to null.","solutions":["Null-check the page before calling PushModalAsync","Ensure the page factory or resolver always returns a valid Page instance","Use a guard clause: if (page == null) return;"],"exampleFix":"// before\nawait Navigation.PushModalAsync(resolvedPage); // throws if resolvedPage is null\n\n// after\nif (resolvedPage == null)\n    throw new InvalidOperationException(\"Page could not be resolved\");\nawait Navigation.PushModalAsync(resolvedPage);","handlingStrategy":"validation","validationCode":"// Before calling PushModalAsync, null-check the page\nif (page == null)\n    throw new ArgumentNullException(nameof(page), \"Cannot push a null page modally\");\nawait Navigation.PushModalAsync(page);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always null-check page references before navigation calls","Ensure page factories/resolvers return valid instances or throw early","Use guard clauses at the top of navigation methods"],"tags":["navigation","null-argument","validation","winui","uwp"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}