{"record":{"id":"f721622e4a9a84cb","repo":"dotnet/wpf","slug":"the-guid-is-not-part-of-the-extendedpropertycollection","errorCode":null,"errorMessage":"The GUID is not part of the ExtendedPropertyCollection.","messagePattern":"The GUID is not part of the ExtendedPropertyCollection\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/ExtendedPropertyCollection.cs","lineNumber":168,"sourceCode":"                throw new ArgumentException(SR.EPExists, nameof(id));\n            }\n\n            ExtendedProperty extendedProperty = new ExtendedProperty(id, value);\n\n            //this will raise change events\n            this.Add(extendedProperty);\n        }\n\n\n        /// <summary>\n        /// Remove\n        /// </summary>\n        /// <param name=\"id\">id</param>\n        internal void Remove(Guid id)\n        {\n            if (!Contains(id))\n            {\n                throw new ArgumentException(SR.EPGuidNotFound, nameof(id));\n            }\n\n            ExtendedProperty propertyToRemove = GetExtendedPropertyById(id);\n            System.Diagnostics.Debug.Assert(propertyToRemove != null);\n\n            _extendedProperties.Remove(propertyToRemove);\n\n            //\n            // this value is bogus now\n            //\n            _optimisticIndex = -1;\n\n            // fire notification event\n            if (this.Changed != null)\n            {\n                ExtendedPropertiesChangedEventArgs eventArgs\n                    = new ExtendedPropertiesChangedEventArgs(propertyToRemove, null);\n                this.Changed(this, eventArgs);","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/ExtendedPropertyCollection.cs#L150-L186","documentation":"ExtendedPropertyCollection.Remove(Guid) verifies the id exists via Contains(id) and throws ArgumentException(SR.EPGuidNotFound, nameof(id)) — 'The GUID is not part of the ExtendedPropertyCollection.' — when it does not. You can only remove a property whose GUID was previously added.","triggerScenarios":"Calling Remove(guid) with a GUID never added to the collection, or after it was already removed; PersistExtendedProperties processing stale ids from a saved configuration or schema that no longer matches the ink data.","commonSituations":"Removing a well-known application property (e.g. a drawing-attribute GUID) from strokes that never had it; double-deletion in cleanup code; ids drifting between app versions so persisted ids no longer exist on loaded ink.","solutions":["Check Contains(guid) before calling Remove and skip if absent.","Track which ids were actually added (or diff collection contents) before cleanup passes.","Catch ArgumentException named 'id' and treat it as a no-op when best-effort removal is intended.","Keep the set of valid property GUIDs in sync with the data that created them (single source of truth)."],"exampleFix":"// before\nproperties.Remove(guid); // ArgumentException if not present\n// after\nif (properties.Contains(guid))\n{\n    properties.Remove(guid);\n}","handlingStrategy":"validation","validationCode":"if (properties.Contains(id))\n    properties.Remove(id);","typeGuard":"static bool IsRemovable(ExtendedPropertyCollection c, Guid id) => c.Contains(id);","tryCatchPattern":"try { properties.Remove(id); }\ncatch (ArgumentException ex) when (ex.ParamName == \"id\") { /* not present: treat as no-op */ }","preventionTips":["Always guard Remove with Contains","Track ids actually added by your pipeline","Keep known property-GUID lists in sync across app versions"],"tags":["wpf","ink","extendedpropertycollection","argumentexception","key-not-found"],"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-21T21:30:21.729Z"}