{"record":{"id":"c8d6e4acbeb52c80","repo":"AvaloniaUI/Avalonia","slug":"propertyname","errorCode":null,"errorMessage":"propertyName","messagePattern":"propertyName","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Rendering/Composition/CompositionObject.cs","lineNumber":73,"sourceCode":"        }\n\n        /// <summary>\n        /// Connects an animation with the specified property of the object and starts the animation.\n        /// </summary>\n        public void StartAnimation(string propertyName, CompositionAnimation animation)\n            => StartAnimation(propertyName, animation, null);\n        \n        internal virtual void StartAnimation(string propertyName, CompositionAnimation animation, ExpressionVariant? finalValue)\n        {\n            throw new ArgumentException(\"Unknown property \" + propertyName);\n        }\n\n        /// <summary>Disconnects an animation from the specified property and stops the animation.</summary>\n        /// <param name=\"propertyName\">The name of the property to disconnect the animation from.</param>\n        public void StopAnimation(string propertyName)\n        {\n            if (propertyName is null)\n                throw new ArgumentNullException(nameof(propertyName));\n            if (Server is not ServerObject srv)\n                return;\n            var prop = srv.GetCompositionProperty(propertyName) ?? throw new ArgumentException(\"Unknown property \" + propertyName);\n            srv.Animations?.RemoveAnimationForProperty(prop);\n        }\n\n        /// <summary>\n        /// Starts an animation group.\n        /// The StartAnimationGroup method on CompositionObject lets you start CompositionAnimationGroup.\n        /// All the animations in the group will be started at the same time on the object.\n        /// </summary>\n        public void StartAnimationGroup(ICompositionAnimationBase grp)\n        {\n            if (grp is CompositionAnimation animation)\n            {\n                if(animation.Target == null)\n                    throw new ArgumentException(\"Animation Target can't be null\");\n                StartAnimation(animation.Target, animation);","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs#L55-L91","documentation":"StopAnimation guards its contract by rejecting a null property name with ArgumentNullException(nameof(propertyName)) before touching the server object. It is a pure argument-validation failure independent of any server state.","triggerScenarios":"Calling StopAnimation(null) on any CompositionObject.","commonSituations":"Passing a null/unchecked string variable as the property name, or calling StopAnimation inside cleanup code where the property name field was never initialized.","solutions":["Pass a non-null property name literal or validate the string before calling StopAnimation.","Guard with a null check (or string.IsNullOrEmpty) and skip the call when there is nothing to stop.","Store the property name used at StartAnimation time and reuse the same value when stopping."],"exampleFix":"// before\nvisual.StopAnimation(_maybeNullField);\n\n// after\nif (!string.IsNullOrEmpty(_maybeNullField))\n    visual.StopAnimation(_maybeNullField);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(propertyName)) return;\nvisual.StopAnimation(propertyName);","typeGuard":"static bool IsValidPropertyName(string? s) => !string.IsNullOrEmpty(s);","tryCatchPattern":null,"preventionTips":["Validate property-name inputs before calling StopAnimation.","Store the property name used at StartAnimation time and reuse it when stopping.","Avoid passing unchecked external strings directly as property names."],"tags":["composition","animation","argument-null","validation"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}