{"record":{"id":"c490811fd81162b3","repo":"stride3d/stride","slug":"can-t-find-a-type-with-alias-typename-did-you-properly-set-a","errorCode":null,"errorMessage":"Can't find a type with alias {typeName}; did you properly set a DataContractAttribute with this alias?","messagePattern":"Can't find a type with alias (.+?); did you properly set a DataContractAttribute with this alias\\?","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Engine/Engine/Design/EntityChildPropertyResolver.cs","lineNumber":41,"sourceCode":"            get { return typeof(Entity); }\n        }\n\n        public override UpdatableMember ResolveProperty(string memberName)\n        {\n            return new EntityChildPropertyAccessor(memberName);\n        }\n\n        public override UpdatableMember ResolveIndexer(string indexerName)\n        {\n            // Note: we currently only support component with data contract aliases\n            var dotIndex = indexerName.LastIndexOf('.');\n\n            // TODO: Temporary hack to get static field of the requested type/property name\n            // Need to have access to DataContract name<=>type mapping in the runtime (only accessible in Stride.Core.Design now)\n            var typeName = (dotIndex == -1) ? indexerName : indexerName.Substring(0, dotIndex);\n            var type = DataSerializerFactory.GetTypeFromAlias(typeName);\n            if (type == null)\n                throw new InvalidOperationException($\"Can't find a type with alias {typeName}; did you properly set a DataContractAttribute with this alias?\");\n\n            return new EntityComponentPropertyAccessor(type);\n        }\n\n        private class EntityChildPropertyAccessor : UpdatableCustomAccessor\n        {\n            private readonly string childName;\n\n            public EntityChildPropertyAccessor(string childName)\n            {\n                this.childName = childName;\n            }\n\n            /// <inheritdoc/>\n            public override Type MemberType => typeof(Entity);\n\n            /// <inheritdoc/>\n            public override void GetBlittable(IntPtr obj, IntPtr data)","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Engine/Engine/Design/EntityChildPropertyResolver.cs#L23-L59","documentation":"EntityChildPropertyResolver.ResolveIndexer resolves an indexer string like 'TypeName.Property' by looking up the type via DataSerializerFactory.GetTypeFromAlias. It throws InvalidOperationException when no type is registered under that alias, meaning the target class lacks a DataContractAttribute with a matching alias (or its assembly was not scanned/registered).","triggerScenarios":"Using an animation/script property path whose prefix before the dot does not match any DataContract alias, referencing a type in an assembly that is not registered with the serializer factory, or renaming a class without updating its alias.","commonSituations":"Custom component types without [DataContract(\"MyAlias\")], AOT/trimming stripping the registration, or typos in the property key path authored in the editor.","solutions":["Add or correct [DataContract(\"alias\")] on the target type so the alias matches the prefix used in the path.","Ensure the assembly containing the type is processed by the Stride serializer/assembly registry.","Check the typeName (text before the first dot) in the property path for typos."],"exampleFix":"// before\nclass MyComponent : SyncScript { ... } // no alias\n// after\n[DataContract(\"MyComponent\")]\nclass MyComponent : SyncScript { ... }","handlingStrategy":"validation","validationCode":"var typeName = indexerName.Contains('.') ? indexerName.Substring(0, indexerName.IndexOf('.')) : indexerName;\nif (DataSerializerFactory.GetTypeFromAlias(typeName) == null)\n    throw new InvalidOperationException($\"Type alias '{typeName}' not registered; add [DataContract(\\\"{typeName}\\\")].\");","typeGuard":null,"tryCatchPattern":"try { resolver.ResolveIndexer(path); }\ncatch (InvalidOperationException ex) { Log.Error($\"Property path alias missing: {ex.Message}\"); }","preventionTips":["Annotate every type referenced by property paths with [DataContract(\"alias\")].","Keep aliases in sync when renaming classes.","Verify assembly registration in trimming/AOT builds where reflection data may be stripped."],"tags":["serialization","datacontract","reflection"],"backgroundTag":"class-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}