{"record":{"id":"b591864674262278","repo":"dotnet/wpf","slug":"styluspointproperty","errorCode":null,"errorMessage":"stylusPointProperty","messagePattern":"stylusPointProperty","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs","lineNumber":151,"sourceCode":"        /// </summary>\n        /// <param name=\"stylusPointProperty\">stylusPointProperty</param>\n        public StylusPointPropertyInfo GetPropertyInfo(StylusPointProperty stylusPointProperty)\n        {\n            ArgumentNullException.ThrowIfNull(stylusPointProperty);\n            return GetPropertyInfo(stylusPointProperty.Id);\n        }\n\n        /// <summary>\n        /// GetPropertyInfo\n        /// </summary>\n        /// <param name=\"guid\">guid</param>\n        internal StylusPointPropertyInfo GetPropertyInfo(Guid guid)\n        {\n            int index = IndexOf(guid);\n            if (-1 == index)\n            {\n                //we didn't find it\n                throw new ArgumentException(\"stylusPointProperty\");\n            }\n            return _stylusPointPropertyInfos[index];\n        }\n\n        /// <summary>\n        /// Returns the index of the given StylusPointProperty by ID, or -1 if none is found\n        /// </summary>\n        internal int GetPropertyIndex(Guid guid)\n        {\n            return IndexOf(guid);\n        }\n\n        /// <summary>\n        /// GetStylusPointProperties\n        /// </summary>\n        public ReadOnlyCollection<StylusPointPropertyInfo> GetStylusPointProperties()\n        {\n            return new ReadOnlyCollection<StylusPointPropertyInfo>(_stylusPointPropertyInfos);","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs#L133-L169","documentation":"StylusPointDescription.GetPropertyInfo(guid) looks up a StylusPointPropertyInfo by its property Guid and throws a bare ArgumentException(\"stylusPointProperty\") when the Guid is not part of this description. The parameter-name string is used as the message, so the message itself is just 'stylusPointProperty' — the actual problem is an unknown/unregistered property ID.","triggerScenarios":"Calling GetPropertyInfo with a Guid that was never added to the StylusPointDescription, e.g. a custom property Guid or a button Guid not included when the description was built.","commonSituations":"Reading a custom packet property from a StylusPoint whose description was changed (Reformat) to drop that property; querying a button property on a description built without buttons; using a hardcoded Guid that differs from the device's reported Guid.","solutions":["Before calling, check description.HasProperty(guid) (or IndexOf via internal API) and handle absence.","Ensure the property Guid was included in the StylusPointDescription when it was constructed or in the source description passed to GetStylusPointDescription.","Use StylusPoint.GetStylusPointPropertyInfo / the description returned by the StylusPoints collection rather than a hand-built description.","Wrap in try-catch for ArgumentException when the property is optional."],"exampleFix":"// before\nvar info = description.GetPropertyInfo(myCustomPropertyId); // throws if absent\n// after\nif (description.GetStylusPointProperties().Any(p => p.Id == myCustomPropertyId))\n{\n    var info = description.GetPropertyInfo(myCustomPropertyId);\n}","handlingStrategy":"try-catch","validationCode":"bool exists = description.GetStylusPointProperties().Any(p => p.Id == guid);","typeGuard":null,"tryCatchPattern":"try { var info = description.GetPropertyInfo(guid); }\ncatch (ArgumentException) { info = null; /* property not in this description */ }","preventionTips":["Check membership before lookup","Keep the description instance that produced the StylusPoints","Avoid hardcoding Guids; read them from the description"],"tags":["wpf","stylus","argument-exception","lookup"],"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"}