{"record":{"id":"a347a0cbc28ae558","repo":"dotnet/wpf","slug":"sr-pagecontentnotfound","errorCode":null,"errorMessage":"SR.PageContentNotFound","messagePattern":"SR\\.PageContentNotFound","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/PageContent.cs","lineNumber":374,"sourceCode":"            return false;\n        }\n\n        internal Stream GetPageStream()\n        {\n            Uri uriToLoad = _ResolveUri();\n            Stream pageStream = null;\n\n            if (uriToLoad != null)\n            {\n                // Package-boundary guard. Reject any uriToLoad that is not\n                // an absolute pack:// reference inside the same package as\n                // the parent (this PageContent's BaseUri). This enforces\n                // XPS specification containment requirements.\n                XpsLoadingContext.EnforcePackageRelativeUri(((IUriContext)this).BaseUri, uriToLoad);\n                pageStream = WpfWebRequestHelper.CreateRequestAndGetResponseStream(uriToLoad);\n                if (pageStream == null)\n                {\n                    throw new ApplicationException(SR.PageContentNotFound);\n                }\n            }\n\n            return pageStream;\n        }\n        #endregion Internal Methods\n\n\n        //--------------------------------------------------------------------\n        //\n        // Internal Properties\n        //\n        //---------------------------------------------------------------------\n\n        #region Internal Properties\n        // return nested PageStream\n        internal FixedPage PageStream\n        {","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/PageContent.cs#L356-L392","documentation":"GetPageStream throws ApplicationException with SR.PageContentNotFound when the web request created for the page's Source URI returns a null stream, meaning the referenced page content could not be retrieved from the package/URI.","triggerScenarios":"Calling GetPageStream (or IPageContent_REMOTE GetPageAsync paths) for a PageContent whose Source URI points to a non-existent or unreachable page part after EnforcePackageRelativeUri validation passed.","commonSituations":"Broken or renamed .fpage parts inside an XPS package; missing relationship targets; manually edited ZIP package where page files were removed or paths mis-cased.","solutions":["Verify the page part exists at the URI the PageContent.Source resolves to inside the package","Regenerate or repair the XPS package so relationship targets match actual parts","Check URI casing and package-relative path correctness (XPS URIs are case-sensitive)"],"exampleFix":"// before\n// Source=\"/Documents/Pages/Page1.fpage\" but part is \"/Documents/pages/Page1.fpage\"\n// after\n// fix Source to match the actual part path exactly\npageContent.Source = new Uri(\"/Documents/pages/Page1.fpage\", UriKind.Relative);","handlingStrategy":"try-catch","validationCode":"var uri = ((IUriContext)pageContent).BaseUri; // verify Source resolves within package before requesting","typeGuard":null,"tryCatchPattern":"try { var s = GetPageStream(uri); } catch (ApplicationException) { /* page part missing: repair package or use fallback */ }","preventionTips":["Validate XPS package integrity (part existence and relationships) before loading","Keep Source URIs consistent with actual part paths and casing","Repair rather than hand-edit package ZIPs"],"tags":["wpf","xps","resource-not-found","uri"],"backgroundTag":"resource-not-found","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"}