{"record":{"id":"9901e5d81f79e6ae","repo":"AvaloniaUI/Avalonia","slug":"unknown-property-propertyname","errorCode":null,"errorMessage":"Unknown property {propertyName}","messagePattern":"Unknown property (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Rendering/Composition/CompositionObject.cs","lineNumber":65,"sourceCode":"        private static SimpleServerObject ThrowInvalidOperation() =>\n            throw new InvalidOperationException(\"There is no server-side counterpart for this object\");\n\n        protected internal void Dispose()\n        {\n            if (!IsDisposed && Server != null)\n                Compositor.DisposeOnNextBatch(Server);\n            IsDisposed = true;\n        }\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.","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs#L47-L83","documentation":"The base CompositionObject.StartAnimation is virtual and throws unconditionally; concrete composition types receive a source-generated override (CompositionGenerator.Generator.cs:557) that dispatches their declared animatable properties and falls through to this base throw for anything else. So the exception fires when the requested property name is not an animatable property of the object's concrete type.","triggerScenarios":"Calling obj.StartAnimation(\"Foo\", anim) where \"Foo\" is not a declared animatable property of the concrete composition type, or calling StartAnimation on a type that has no animatable properties at all (e.g. CompositionPropertySet, CompositionBrush).","commonSituations":"Typos or wrong casing in the property name, animating a read-only or non-animatable property, or targeting an object type (property sets, brushes) that does not support direct property animation.","solutions":["Use a property name that exists and is animatable on the concrete type (e.g. \"Opacity\", \"Offset\", \"Size\", \"RotationAngle\", \"Scale\" on CompositionVisual).","Animate a CompositionVisual / CompositionSpriteVisual rather than a CompositionPropertySet or CompositionBrush.","Double-check spelling and casing of the property name against the type's documented animatable properties.","Prefer StartAnimation(propertyName, animation) with the explicit name over StartAnimationGroup when in doubt."],"exampleFix":"// before\nvisual.StartAnimation(\"Opasity\", anim); // typo -> Unknown property\n\n// after\nvisual.StartAnimation(\"Opacity\", anim);","handlingStrategy":"validation","validationCode":"// Validate the property name against the concrete type's known animatable properties.\nstatic readonly HashSet<string> VisualAnimatable = new() { \"Opacity\", \"Offset\", \"Size\", \"RotationAngle\", \"RotationAxis\", \"Scale\", \"AnchorPoint\", \"CenterPoint\" };\nif (!VisualAnimatable.Contains(propertyName))\n    throw new ArgumentOutOfRangeException(nameof(propertyName));\nvisual.StartAnimation(propertyName, anim);","typeGuard":"static bool IsAnimatable(CompositionObject o) => o is CompositionVisual;","tryCatchPattern":"try { visual.StartAnimation(propertyName, anim); }\ncatch (ArgumentException ex) when (ex.Message.StartsWith(\"Unknown property\"))\n{ /* log and fall back to a known-good property or skip animation */ }","preventionTips":["Animate CompositionVisual types, not CompositionPropertySet/CompositionBrush.","Keep animated property names in shared string constants.","Cross-check property names against the type's documentation before animating."],"tags":["composition","animation","property-name","argument"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}