{"record":{"id":"16f33c032e608c3e","repo":"dotnet/wpf","slug":"sr-invalidstyluspointpropertyinforesolution","errorCode":null,"errorMessage":"SR.InvalidStylusPointPropertyInfoResolution","messagePattern":"SR\\.InvalidStylusPointPropertyInfoResolution","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointPropertyInfo.cs","lineNumber":62,"sourceCode":"        public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty, int minimum, int maximum, StylusPointPropertyUnit unit, float resolution)\n            : base(stylusPointProperty) //base checks for null\n        {\n            // validate unit\n            if (!StylusPointPropertyUnitHelper.IsDefined(unit))\n            {\n                throw new InvalidEnumArgumentException(\"unit\", (int)unit, typeof(StylusPointPropertyUnit));\n            }\n\n            // validate min/max\n            if (maximum < minimum)\n            {\n                throw new ArgumentException(SR.Stylus_InvalidMax, nameof(maximum));\n            }\n\n            // validate resolution\n            if (resolution < 0.0f)\n            {\n                throw new ArgumentException(SR.InvalidStylusPointPropertyInfoResolution, nameof(resolution));\n            }\n\n            _min = minimum;\n            _max = maximum;\n            _resolution = resolution;\n            _unit = unit;\n        }\n\n        /// <summary>\n        /// Minimum\n        /// </summary>\n        public int Minimum\n        {\n            get { return _min; }\n        }\n\n        /// <summary>\n        /// Maximum","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointPropertyInfo.cs#L44-L80","documentation":"StylusPointPropertyInfo's constructor validates that the resolution is non-negative. A negative resolution (samples per unit) is meaningless, so ArgumentException SR.InvalidStylusPointPropertyInfoResolution is thrown for the 'resolution' parameter.","triggerScenarios":"Calling new StylusPointPropertyInfo(...) with a negative float for resolution, typically from misparsed or defaulted device metrics.","commonSituations":"Parsing device description XML where a resolution field is negative or a sentinel (-1) meaning 'unknown'; arithmetic producing negative results for high-resolution axes.","solutions":["Pass a positive resolution value; treat unknown as a sensible default rather than a negative number","Clamp with Math.Max(0f, resolution) before constructing","Fix the upstream parsing of device metrics so sentinel values don't leak in"],"exampleFix":"// before\nnew StylusPointPropertyInfo(prop, unit, -400f, 0, 100);\n// after\nnew StylusPointPropertyInfo(prop, unit, Math.Max(0f, resolution), 0, 100);","handlingStrategy":"validation","validationCode":"if (resolution < 0f) resolution = 0f; // or reject\nvar info = new StylusPointPropertyInfo(prop, unit, resolution, min, max);","typeGuard":null,"tryCatchPattern":"try { var info = new StylusPointPropertyInfo(prop, unit, res, min, max); }\ncatch (ArgumentException ex) when (ex.ParamName == \"resolution\") { /* substitute default resolution */ }","preventionTips":["Treat negative/unknown resolution as 'use default', never pass it through","Validate parsed device metrics before constructing property infos"],"tags":["wpf","stylus","argument-validation"],"backgroundTag":"value-out-of-range","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"}