{"record":{"id":"aa9c3ebc83da3416","repo":"dotnet/wpf","slug":"styluspointdescription-aa9c3e","errorCode":null,"errorMessage":"stylusPointDescription","messagePattern":"stylusPointDescription","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs","lineNumber":290,"sourceCode":"\n        /// <summary>\n        /// Internal helper to determine the original pressure index\n        /// </summary>\n        internal int OriginalPressureIndex\n        {\n            get { return _originalPressureIndex; }\n        }\n\n        /// <summary>\n        /// Returns true if the two StylusPointDescriptions have the same StylusPointProperties.  Metrics are ignored.\n        /// </summary>\n        /// <param name=\"stylusPointDescription1\">stylusPointDescription1</param>\n        /// <param name=\"stylusPointDescription2\">stylusPointDescription2</param>\n        public static bool AreCompatible(StylusPointDescription stylusPointDescription1, StylusPointDescription stylusPointDescription2)\n        {\n            if (stylusPointDescription1 == null || stylusPointDescription2 == null)\n            {\n                throw new ArgumentNullException(\"stylusPointDescription\");\n            }\n\n            // if a StylusPointDescription is not null, then _stylusPointPropertyInfos is not null.\n            //\n            // ignore X, Y, Pressure - they are guaranteed to be the first3 members\n            //\n            Debug.Assert(   stylusPointDescription1._stylusPointPropertyInfos.Length >= RequiredCountOfProperties &&\n                            stylusPointDescription1._stylusPointPropertyInfos[0].Id == StylusPointPropertyIds.X &&\n                            stylusPointDescription1._stylusPointPropertyInfos[1].Id == StylusPointPropertyIds.Y &&\n                            stylusPointDescription1._stylusPointPropertyInfos[2].Id == StylusPointPropertyIds.NormalPressure);\n\n            Debug.Assert(   stylusPointDescription2._stylusPointPropertyInfos.Length >= RequiredCountOfProperties &&\n                            stylusPointDescription2._stylusPointPropertyInfos[0].Id == StylusPointPropertyIds.X &&\n                            stylusPointDescription2._stylusPointPropertyInfos[1].Id == StylusPointPropertyIds.Y &&\n                            stylusPointDescription2._stylusPointPropertyInfos[2].Id == StylusPointPropertyIds.NormalPressure);\n\n            if (stylusPointDescription1._stylusPointPropertyInfos.Length != stylusPointDescription2._stylusPointPropertyInfos.Length)\n            {","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs#L272-L308","documentation":"The static StylusPointDescription.AreCompatible throws ArgumentNullException (message 'stylusPointDescription') when either argument is null. Compatibility comparison requires two non-null descriptions since every stylus point stream must have a defined description.","triggerScenarios":"Calling StylusPointDescription.AreCompatible(desc1, desc2) where desc1 or desc2 is null, commonly when a device's GetStylusPointDescription returned null or a field/default was never initialized.","commonSituations":"Comparing descriptions before a TabletDevice/StylusDevice is available (null until device attached); passing a nullable field that defaulted to null in a configuration path.","solutions":["Check both arguments for null before calling AreCompatible and skip the comparison (or treat missing description as incompatible) when null.","Ensure the StylusDevice/TabletDevice is available before reading its description.","Use reference equality shortcut: if both are the same instance they are compatible without the call."],"exampleFix":"// before\nbool compat = StylusPointDescription.AreCompatible(d1, d2);\n// after\nbool compat = d1 != null && d2 != null && StylusPointDescription.AreCompatible(d1, d2);","handlingStrategy":"validation","validationCode":"if (d1 == null || d2 == null) return false; // or defer until descriptions are available","typeGuard":"static bool IsNonNull(StylusPointDescription d) => d != null;","tryCatchPattern":"try { return StylusPointDescription.AreCompatible(d1, d2); }\ncatch (ArgumentNullException) { return false; }","preventionTips":["Null-check device-derived descriptions before comparing","Wait until the stylus device is attached before reading descriptions"],"tags":["wpf","stylus","argument-null","null"],"backgroundTag":"null-argument","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"}