{"record":{"id":"37cc8765f630641c","repo":"AvaloniaUI/Avalonia","slug":"s","errorCode":null,"errorMessage":"s","messagePattern":"s","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Media/Transformation/TransformParser.cs","lineNumber":42,"sourceCode":"        private static readonly (string, Unit)[] s_unitMapping =\n        {\n            (\"deg\", Unit.Degree),\n            (\"grad\", Unit.Gradian),\n            (\"rad\", Unit.Radian),\n            (\"turn\", Unit.Turn), \n            (\"px\", Unit.Pixel)\n        };\n\n        public static TransformOperations Parse(string s)\n        {\n            void ThrowInvalidFormat()\n            {\n                throw new FormatException($\"Invalid transform string: '{s}'.\");\n            }\n\n            if (string.IsNullOrEmpty(s))\n            {\n                throw new ArgumentException(nameof(s));\n            }\n\n            var span = s.AsSpan().Trim();\n\n            if (span.Equals(\"none\".AsSpan(), StringComparison.OrdinalIgnoreCase))\n            {\n                return TransformOperations.Identity;\n            }\n\n            var builder = TransformOperations.CreateBuilder(0);\n\n            while (true)\n            {\n                var beginIndex = span.IndexOf('(');\n                var endIndex = span.IndexOf(')');\n\n                if (beginIndex == -1 || endIndex == -1)\n                {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Media/Transformation/TransformParser.cs#L24-L60","documentation":"Thrown by TransformParser.Parse when the input string s is null or empty. This is a precondition ArgumentException that fires before any parsing logic. It is distinct from the FormatException (error 323) which covers syntactically invalid but non-empty strings. The thrown argument name is 's'.","triggerScenarios":"Calling TransformOperations.Parse(null) or TransformOperations.Parse(string.Empty). This may happen when the transform value comes from a binding or config that resolves to null/empty instead of the expected 'none' keyword.","commonSituations":"A style/binding that fails to resolve and yields null passed into Parse; a deserialization path that defaults missing fields to empty string; calling Parse on an unset property before initialization.","solutions":["Handle null/empty input explicitly before calling Parse — treat null or empty as Identity (the parser's 'none' semantics).","Ensure the data source (config/binding) always provides a value or coalesce empty to 'none'.","Wrap with a null-coalescing: TransformOperations.Parse(s ?? \"none\")."],"exampleFix":"// before\nvar t = TransformOperations.Parse(maybeNullString); // throws ArgumentException\n\n// after\nvar t = TransformOperations.Parse(string.IsNullOrEmpty(maybeNullString) ? \"none\" : maybeNullString);","handlingStrategy":"validation","validationCode":"static TransformOperations SafeParseTransform(string s)\n    => string.IsNullOrEmpty(s) ? TransformOperations.Identity : TransformOperations.Parse(s);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Coalesce null/empty transform strings to 'none' before parsing.","Initialize transform properties to 'none' rather than null.","Validate bindings resolve to a non-null value before Parse."],"tags":["transform","parse","argument-exception","null-check","avalonia"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}