{"record":{"id":"3815e1bbcda222d6","repo":"AvaloniaUI/Avalonia","slug":"obj","errorCode":null,"errorMessage":"obj","messagePattern":"obj","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs","lineNumber":41,"sourceCode":"        private readonly Dictionary<string, CompositionObject> _objects = new Dictionary<string, CompositionObject>();\n        \n        internal CompositionPropertySet(Compositor compositor) : base(compositor, null)\n        {\n        }\n\n        internal void Set(string key, ExpressionVariant value)\n        {\n            _objects.Remove(key);\n            _variants[key] = value;\n        }\n\n        /*\n         For INTERNAL USE by CompositionAnimation ONLY, we DON'T support expression\n         paths like SomeParam.SomePropertyObject.SomeValue\n        */\n        internal void Set(string key, CompositionObject obj)\n        {\n            _objects[key] = obj ?? throw new ArgumentNullException(nameof(obj));\n            _variants.Remove(key);\n        }\n        \n        public void InsertColor(string propertyName, Avalonia.Media.Color value) => Set(propertyName, value);\n\n        public void InsertMatrix3x2(string propertyName, Matrix3x2 value) => Set(propertyName, value);\n\n        public void InsertMatrix4x4(string propertyName, Matrix4x4 value) => Set(propertyName, value);\n\n        public void InsertQuaternion(string propertyName, Quaternion value) => Set(propertyName, value);\n\n        public void InsertScalar(string propertyName, float value) => Set(propertyName, value);\n        public void InsertVector2(string propertyName, Vector2 value) => Set(propertyName, value);\n\n        public void InsertVector3(string propertyName, Vector3 value) => Set(propertyName, value);\n\n        public void InsertVector4(string propertyName, Vector4 value) => Set(propertyName, value);\n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs#L23-L59","documentation":"CompositionPropertySet.Set(key, CompositionObject) rejects a null CompositionObject with ArgumentNullException(nameof(obj)). This internal setter is the backing for CompositionAnimation.SetReferenceParameter, which forwards the compositionObject straight into the property set.","triggerScenarios":"Calling CompositionAnimation.SetReferenceParameter(\"key\", null), which internally calls _propertySet.Set(key, null).","commonSituations":"Passing an uninitialized CompositionObject field, or conditionally passing a reference parameter that evaluated to null, into an animation's reference parameters.","solutions":["Never pass null to SetReferenceParameter; only register real composition objects.","Null-check the object before registering it as a reference parameter.","If a parameter is optional, omit the SetReferenceParameter call entirely instead of passing null."],"exampleFix":"// before\nanim.SetReferenceParameter(\"source\", maybeNullVisual);\n\n// after\nif (maybeNullVisual != null)\n    anim.SetReferenceParameter(\"source\", maybeNullVisual);","handlingStrategy":"validation","validationCode":"if (refObject is null) return;\nanim.SetReferenceParameter(\"key\", refObject);","typeGuard":"static bool IsRegistrable(CompositionObject? o) => o is not null && !o.IsDisposed;","tryCatchPattern":null,"preventionTips":["Null-check before SetReferenceParameter.","For optional parameters, omit the call rather than passing null.","Initialize referenced composition objects before registering them."],"tags":["composition","animation","property-set","argument-null","validation"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}