{"record":{"id":"e71f00f77f10f7f4","repo":"dotnet/wpf","slug":"sr-invalidstyluspointdescription","errorCode":null,"errorMessage":"SR.InvalidStylusPointDescription","messagePattern":"SR\\.InvalidStylusPointDescription","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs","lineNumber":55,"sourceCode":"                    StylusPointPropertyInfoDefaults.NormalPressure\n                };\n        }\n\n        /// <summary>\n        /// StylusPointDescription\n        /// </summary>\n        public StylusPointDescription(IEnumerable<StylusPointPropertyInfo> stylusPointPropertyInfos)\n        {\n            ArgumentNullException.ThrowIfNull(stylusPointPropertyInfos);\n            List<StylusPointPropertyInfo> infos =\n                new List<StylusPointPropertyInfo>(stylusPointPropertyInfos);\n\n            if (infos.Count < RequiredCountOfProperties ||\n                infos[RequiredXIndex].Id != StylusPointPropertyIds.X ||\n                infos[RequiredYIndex].Id != StylusPointPropertyIds.Y ||\n                infos[RequiredPressureIndex].Id != StylusPointPropertyIds.NormalPressure)\n            {\n                throw new ArgumentException(SR.InvalidStylusPointDescription, nameof(stylusPointPropertyInfos));\n            }\n\n            //\n            // look for duplicates, validate that buttons are last\n            //\n            List<Guid> seenIds = new List<Guid>();\n            seenIds.Add(StylusPointPropertyIds.X);\n            seenIds.Add(StylusPointPropertyIds.Y);\n            seenIds.Add(StylusPointPropertyIds.NormalPressure);\n\n            int buttonCount = 0;\n            for (int x = RequiredCountOfProperties; x < infos.Count; x++)\n            {\n                if (seenIds.Contains(infos[x].Id))\n                {\n                    throw new ArgumentException(SR.InvalidStylusPointDescriptionDuplicatesFound, nameof(stylusPointPropertyInfos));\n                }\n                if (infos[x].IsButton)","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs#L37-L73","documentation":"The StylusPointDescription constructor validates that its StylusPointPropertyInfoCollection contains at least the required properties (X, Y, NormalPressure) in the required order. This ArgumentException is thrown when the collection is missing one of these mandatory properties or has them in the wrong order, because a StylusPoint without X, Y and pressure data cannot be represented in WPF's stylus pipeline.","triggerScenarios":"Calling new StylusPointDescription(stylusPointPropertyInfos) where the collection has fewer than 3 entries, or infos[0].Id != StylusPointPropertyIds.X, or infos[1].Id != StylusPointPropertyIds.Y, or infos[2].Id != StylusPointPropertyIds.NormalPressure.","commonSituations":"Building a custom StylusPointDescription for a digitizer/tablet integration and forgetting that X, Y, and NormalPressure must be the first three properties in exactly that order; copying property lists from raw device packets where pressure was omitted; reordering the collection to put buttons or custom properties first.","solutions":["Ensure the StylusPointPropertyInfo collection starts with exactly StylusPointPropertyInfoForX, StylusPointPropertyInfoForY, then StylusPointPropertyInfoForNormalPressure, in that order.","Append any additional properties (custom axes) after those first three.","Append StylusPointPropertyInfo button entries last (buttons must come after all non-button properties).","If constructing from raw device data, map each packet field to a StylusPointPropertyInfo and skip fields that do not map to X/Y/pressure, placing them after the required trio."],"exampleFix":"// before\nvar infos = new StylusPointPropertyInfo[] {\n    new StylusPointPropertyInfo(StylusPointPropertyIds.NormalPressure),\n    new StylusPointPropertyInfo(StylusPointPropertyIds.X),\n    new StylusPointPropertyInfo(StylusPointPropertyIds.Y)};\nvar desc = new StylusPointDescription(infos);\n// after\nvar infos = new StylusPointPropertyInfo[] {\n    StylusPointPropertyInfo.StylusPointPropertyInfoForX,\n    StylusPointPropertyInfo.StylusPointPropertyInfoForY,\n    StylusPointPropertyInfo.StylusPointPropertyInfoForNormalPressure};\nvar desc = new StylusPointDescription(infos);","handlingStrategy":"validation","validationCode":"bool ok = infos != null && infos.Count >= 3 &&\n    infos[0].Id == StylusPointPropertyIds.X &&\n    infos[1].Id == StylusPointPropertyIds.Y &&\n    infos[2].Id == StylusPointPropertyIds.NormalPressure;\nif (!ok) throw new ArgumentException(\"First three properties must be X, Y, NormalPressure\", nameof(infos));","typeGuard":null,"tryCatchPattern":"try { var desc = new StylusPointDescription(infos); }\ncatch (ArgumentException) { /* fall back to stylusDevice.StylusPointDescription or default description */ }","preventionTips":["Always start the collection with the X, Y, NormalPressure predefined StylusPointPropertyInfos","Append custom axes after the required trio","Keep buttons last and in device order"],"tags":["wpf","stylus","argument-exception","input"],"backgroundTag":"invalid-argument-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"}