{"record":{"id":"ff7288ef712d5ed1","repo":"dotnet/wpf","slug":"sr-unknowndocumentproperty-fmtid-propid","errorCode":null,"errorMessage":"SR.UnknownDocumentProperty (fmtid, propId)","messagePattern":"SR\\.UnknownDocumentProperty \\(fmtid, propId\\)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/StorageBasedPackageProperties.cs","lineNumber":824,"sourceCode":"            {\n                switch (propId)\n                {\n                    case PropertyId.Title:\n                    case PropertyId.Subject:\n                    case PropertyId.Creator:\n                    case PropertyId.Keywords:\n                    case PropertyId.Description:\n                    case PropertyId.LastModifiedBy:\n                    case PropertyId.Revision:\n                        return VARTYPE.VT_LPSTR;\n\n                    case PropertyId.LastPrinted:\n                    case PropertyId.DateCreated:\n                    case PropertyId.DateModified:\n                        return VARTYPE.VT_FILETIME;\n\n                    default:\n                        throw new ArgumentException(\n                            SR.Format(SR.UnknownDocumentProperty, fmtid.ToString(), propId),\n                            nameof(propId)\n                            );\n                }\n            }\n            else if (fmtid == FormatId.DocumentSummaryInformation)\n            {\n                switch (propId)\n                {\n                    case PropertyId.Category:\n                    case PropertyId.Identifier:\n                    case PropertyId.ContentType:\n                    case PropertyId.Language:\n                    case PropertyId.Version:\n                    case PropertyId.ContentStatus:\n                        return VARTYPE.VT_LPSTR;\n\n                    default:","sourceCodeStart":806,"sourceCodeEnd":842,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/StorageBasedPackageProperties.cs#L806-L842","documentation":"ArgumentException with message UnknownDocumentProperty(fmtid, propId) (paramName 'propId') thrown by StorageBasedPackageProperties.GetVtFromPropId when the property-set lookup table has no entry mapping the given fmtid/propId combination to a VARTYPE. vtExpected relies on this mapping, so an unmapped property id cannot be read.","triggerScenarios":"Calling GetOleProperty (via a PackageProperties getter) with a propId that exists in the property stream but is not one of the well-known ids (Title, Subject, Author, Keywords, etc.) handled by the switch — including unknown ids under the SummaryInformation or DocumentSummaryInformation format ids.","commonSituations":"Extending the properties reader to custom property ids without registering them; files carrying extra properties that internal code iterates and tries to resolve.","solutions":["Only request well-known package properties via PackageProperties.","If supporting custom ids, add a case to GetVtFromPropId returning the correct VARTYPE.","Use a dedicated OLE property-set library for arbitrary custom properties instead of this mapping.","Check the fmtid/propId spelling — a wrong constant lookup triggers the default case."],"exampleFix":"// before\nvt = GetVtFromPropId(fmtid, (PropertyId)0x9999); // throws\n// after\nif (Enum.IsDefined(typeof(PropertyId), propId) && IsKnownProperty(fmtid, propId))\n    vt = GetVtFromPropId(fmtid, propId);\nelse\n    return null; // skip unknown property","handlingStrategy":"validation","validationCode":"if (!Enum.IsDefined(typeof(PropertyId), propId)) return null; // skip unknown property","typeGuard":null,"tryCatchPattern":"try { vt = GetVtFromPropId(fmtid, propId); }\ncatch (ArgumentException ex) when (ex.ParamName == \"propId\") { return null; /* unmapped property */ }","preventionTips":["Restrict reads to well-known PackageProperties accessors","Register any custom propId in the fmtid/propId -> VARTYPE mapping first","Verify property id constants against the MS-OLEPS specification"],"tags":["argumentexception","ole-properties","propertyid","metadata"],"backgroundTag":"invalid-enum-value","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"}