{"record":{"id":"5b0d3fe5ce3dd0aa","repo":"dotnet/wpf","slug":"property-not-set","errorCode":null,"errorMessage":"Property not set.","messagePattern":"Property not set\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/ExtendedPropertyCollection.cs","lineNumber":228,"sourceCode":"        }\n\n        /// <summary>\n        /// Generic accessor for the ExtendedPropertyCollection. \n        /// </summary>\n        /// <param name=\"attributeId\">Attribue Id to find</param>\n        /// <returns>Value for attribute specified by Id</returns>\n        /// <exception cref=\"System.ArgumentException\">Specified identifier was not found</exception>\n        /// <remarks>\n        /// Note that you can access extended properties via this indexer.\n        /// </remarks>\n        internal object this[Guid attributeId]\n        {\n            get\n            {\n                ExtendedProperty ep = GetExtendedPropertyById(attributeId);\n                if (ep == null)\n                {\n                    throw new ArgumentException(SR.EPNotFound, nameof(attributeId));\n                }\n                return ep.Value;\n            }\n            set\n            {\n                ArgumentNullException.ThrowIfNull(value);\n                for (int i = 0; i < _extendedProperties.Count; i++)\n                {\n                    ExtendedProperty currentProperty = _extendedProperties[i];\n\n                    if (currentProperty.Id == attributeId)\n                    {\n                        object oldValue = currentProperty.Value;\n                        //this will raise events\n                        currentProperty.Value = value;\n\n                        //raise change if anyone is listening\n                        if (this.Changed != null)","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/ExtendedPropertyCollection.cs#L210-L246","documentation":"The ExtendedPropertyCollection indexer getter resolves the property by attributeId via GetExtendedPropertyById; when no property with that GUID exists it throws ArgumentException(SR.EPNotFound, nameof(attributeId)) — 'Property not set.' — because reading an unset extended property has no default value.","triggerScenarios":"Reading collection[guid] (or GetPropertyData on a Stroke/ContextNode) where the property was never added, or before it was set; checking a property added only conditionally by another code path.","commonSituations":"Reading optional metadata from ink imported from another application; assuming a property was set by a previous pipeline stage that skipped it; using a GUID from a different ink schema/version.","solutions":["Check Contains(attributeId) / HasPropertyData before reading via the indexer.","Use TryGetValue-style access by wrapping the read in try/catch for ArgumentException.","Ensure the pipeline stage that writes the property always runs before the read.","Provide an explicit default value at the call site when the property is optional."],"exampleFix":"// before\nvar value = properties[attributeId]; // ArgumentException: Property not set.\n// after\nobject value = properties.Contains(attributeId) ? properties[attributeId] : defaultValue;","handlingStrategy":"validation","validationCode":"object value = properties.Contains(attributeId)\n    ? properties[attributeId]\n    : defaultValue;","typeGuard":"static bool TryGetProperty(ExtendedPropertyCollection c, Guid id, out object value)\n{\n    if (c.Contains(id)) { value = c[id]; return true; }\n    value = null; return false;\n}","tryCatchPattern":"object value;\ntry { value = properties[attributeId]; }\ncatch (ArgumentException) { value = defaultValue; /* property not set */ }","preventionTips":["Check Contains before indexer reads","Provide explicit defaults for optional properties","Guarantee writer stages run before readers"],"tags":["wpf","ink","extendedpropertycollection","key-not-found","argumentexception"],"backgroundTag":"record-not-found","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}