{"record":{"id":"3297698020c3edbe","repo":"AvaloniaUI/Avalonia","slug":"there-is-no-server-side-counterpart-for-this-objec","errorCode":null,"errorMessage":"There is no server-side counterpart for this object","messagePattern":"There is no server-side counterpart for this object","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Rendering/Composition/CompositionObject.cs","lineNumber":48,"sourceCode":"        \n        /// <summary>\n        /// The associated Compositor\n        /// </summary>\n        public Compositor Compositor { get; }\n\n        SimpleServerObject ICompositorSerializable.TryGetServer(Compositor c)\n        {\n            Debug.Assert(c == Compositor);\n            return Server ?? ThrowInvalidOperation();\n        }\n\n        internal SimpleServerObject? Server { get; }\n        public bool IsDisposed { get; private set; }\n        private bool _registeredForSerialization;\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        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        }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs#L30-L66","documentation":"Thrown by ICompositorSerializable.TryGetServer when a CompositionObject that reached the commit-batch serialization queue has no server-side counterpart (Server == null). During every commit, Compositor.CommitCore walks its serialization queue (Compositor.cs:138) and asks each object for its server; some types (CompositionAnimation, CompositionPropertySet) are intentionally built with a null server because they serialize via snapshots, so they must never be queued directly.","triggerScenarios":"An object with Server == null (a bare CompositionObject, a CompositionAnimation, or a CompositionPropertySet) is handed to Compositor.RegisterForSerialization and survives to the next CommitCore, so TryGetServer falls into ThrowInvalidOperation.","commonSituations":"Calling RegisterForSerialization manually on a PropertySet/animation, reusing a composition object across commit boundaries after its server was torn down, or writing a custom CompositionObject subclass that does not pass a server to the base constructor.","solutions":["Do not register CompositionAnimation / CompositionPropertySet / base CompositionObject instances for serialization yourself; let the Compositor own the queue.","Reference PropertySets/animations indirectly via CompositionAnimation.SetReferenceParameter so they serialize through the animation's snapshot path.","If you subclass CompositionObject, supply a real SimpleServerObject to the base ctor so Server is non-null.","Never reuse a composition object after Dispose(); recreate it from the Compositor."],"exampleFix":"// before\ncompositor.RegisterForSerialization(myPropertySet); // PropertySet has Server == null\n\n// after\n// reference it through an animation instead\nanim.SetReferenceParameter(\"mySet\", myPropertySet);","handlingStrategy":"validation","validationCode":"// Only register server-backed objects for serialization; never PropertySets/animations directly.\nif (obj is CompositionAnimation || obj is CompositionPropertySet)\n    return; // these have no Server and serialize via snapshots\ncompositor.RegisterForSerialization(obj);","typeGuard":"static bool HasServerCounterpart(CompositionObject o) => !o.IsDisposed;","tryCatchPattern":null,"preventionTips":["Never call Compositor.RegisterForSerialization on CompositionAnimation or CompositionPropertySet.","Reference PropertySets/animations through CompositionAnimation.SetReferenceParameter so they serialize via the snapshot path.","Do not reuse composition objects after Dispose(); recreate them from the Compositor."],"tags":["composition","compositor","serialization","internal-invariant"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}