{"record":{"id":"f45a31de97a52d00","repo":"dotnet/wpf","slug":"obfuscated-font-resources-require-valid-guid-file-name","errorCode":null,"errorMessage":"Obfuscated font resources require valid GUID file name.","messagePattern":"Obfuscated font resources require valid GUID file name\\.","errorType":"exception","errorClass":"XpsPackagingException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsFixedPageReaderWriter.cs","lineNumber":1911,"sourceCode":"            )\n        {\n            //Extract file extension\n            String path = fontUri.OriginalString;\n            String extension = Path.GetExtension(path);\n            String fileName = Path.GetFileNameWithoutExtension(path);\n\n            ContentType contentType = null;\n            if (string.Equals(extension, XpsS0Markup.ObfuscatedFontExt, StringComparison.OrdinalIgnoreCase))\n            {\n                // Verify that the filename is a valid GUID string\n                // Until Guid has a TryParse method we will have to depend on an exception being thrown\n                try\n                {  \n                    Guid guid = new Guid(fileName );\n                }\n                catch( FormatException )\n                {\n                    throw new XpsPackagingException(SR.ReachPackaging_ObfucatedFontNeedGuid);\n                }\n\n                contentType =  XpsS0Markup.FontObfuscatedContentType;\n            }\n            else\n            {\n                //default to PNG\n                contentType = XpsS0Markup.FontContentType;\n            }\n\n            return contentType;\n         }\n\n\n        #endregion Private methods\n\n        #region Private data\n","sourceCodeStart":1893,"sourceCodeEnd":1929,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsFixedPageReaderWriter.cs#L1893-L1929","documentation":"The XpsFixedPageReaderWriter constructor throws XpsPackagingException(SR.ReachPackaging_ObfucatedFontNeedGuid) when a font part's file name claims to be an obfuscated font but the file name is not a valid GUID. Obfuscated (embedded) XPS fonts must be named '{GUID}.odttf'; the GUID is required to de-obfuscate the font data.","triggerScenarios":"Loading a page whose resource part has an obfuscated-font content type but a file name that Guid.Parse/new Guid() cannot parse — e.g. 'myfont.odttf' or a GUID with braces/wrong format.","commonSituations":"Hand-renamed font files inside an XPS package; third-party producers that mark fonts obfuscated but use arbitrary names; zip repackaging that renamed parts.","solutions":["Rename the font part to a valid GUID file name, e.g. '{0D5C6F4A-...}.odttf'.","If the font is not actually obfuscated, change its content type / relationship to the plain font type instead.","Regenerate the XPS package with the original tooling so fonts are named correctly."],"exampleFix":"// before\n/resources/fonts/myfont.odttf\n// after\n/resources/fonts/{3B4D6F4A-1C2B-4E8A-9F0D-5A6B7C8D9E0F}.odttf","handlingStrategy":"validation","validationCode":"if (fileName.EndsWith(\".odttf\") && !Guid.TryParse(fileName.Trim('{','}').Split('.')[0], out _))\n    throw new XpsPackagingException(\"Obfuscated font needs a GUID file name\");","typeGuard":null,"tryCatchPattern":"try { LoadXps(path); }\ncatch (XpsPackagingException ex) when (ex.Message.Contains(\"Obfuscated font\")) { /* rename part or reject package */ }","preventionTips":["Only mark fonts obfuscated when produced by a compliant XPS generator.","Verify font part names are GUID-formatted when repackaging XPS files."],"tags":["wpf","xps","font","guid"],"backgroundTag":"invalid-identifier-format","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"}