{"record":{"id":"640d707cb66aa81a","repo":"stride3d/stride","slug":"could-not-find-the-appropriate-type","errorCode":null,"errorMessage":"Could not find the appropriate type.","messagePattern":"Could not find the appropriate type\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core/Serialization/Serializers/PropertyInfoSerializer.cs","lineNumber":24,"sourceCode":"using Stride.Core.Reflection;\n\nnamespace Stride.Core.Serialization.Serializers;\n\npublic class PropertyInfoSerializer : DataSerializer<PropertyInfo>\n{\n    public override void Serialize(ref PropertyInfo propertyInfo, ArchiveMode mode, SerializationStream stream)\n    {\n        if (mode == ArchiveMode.Serialize)\n        {\n            stream.Write(propertyInfo.DeclaringType!.AssemblyQualifiedName!);\n            stream.Write(propertyInfo.Name);\n        }\n        else\n        {\n            var declaringTypeName = stream.ReadString();\n            var propertyName = stream.ReadString();\n\n            var ownerType = AssemblyRegistry.GetType(declaringTypeName) ?? throw new InvalidOperationException(\"Could not find the appropriate type.\");\n            propertyInfo = ownerType.GetTypeInfo().GetDeclaredProperty(propertyName)!;\n        }\n    }\n}\n","sourceCodeStart":6,"sourceCodeEnd":29,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core/Serialization/Serializers/PropertyInfoSerializer.cs#L6-L29","documentation":"PropertyInfoSerializer deserializes property references by looking up the declaring type name in AssemblyRegistry and then finding the declared property. If the type name cannot be resolved from registered assemblies, the stream data refers to a type that is unknown to the current process, so deserialization aborts with this InvalidOperationException.","triggerScenarios":"Deserializing a stream containing a property reference whose declaring type name was never loaded/registered via AssemblyRegistry (assembly not loaded, renamed type/assembly, or serialized from a different app version).","commonSituations":"Loading assets saved by another Stride version where a type was renamed or moved; plugin assemblies not loaded before deserialization; obfuscated/trimmed builds that stripped the referenced type.","solutions":["Ensure the assembly declaring the type is loaded and registered in AssemblyRegistry before deserializing","Resave the asset/data with the current type names if the type was renamed","Extend AssemblyRegistry with a type-mapping/alias for renamed types"],"exampleFix":"// before\nAssemblyRegistry.Register(typeof(SomePluginType).Assembly, new[] { \"PluginAssembly\" }); // missing before deserialize\n// after\nAssemblyRegistry.Register(typeof(SomePluginType).Assembly, new[] { \"PluginAssembly\" });\nserializer.Deserialize(stream);","handlingStrategy":"try-catch","validationCode":"if (AssemblyRegistry.GetType(declaringTypeName) is null)\n    throw new InvalidOperationException($\"Type '{declaringTypeName}' not registered; load its assembly first\");","typeGuard":null,"tryCatchPattern":"try { var prop = DeserializePropertyReference(stream); }\ncatch (InvalidOperationException e) when (e.Message.Contains(\"Could not find the appropriate type\"))\n{ /* load missing assembly or skip/repair the reference */ }","preventionTips":["Register all assemblies containing serialized types with AssemblyRegistry before deserialization","Avoid renaming/moving serialized types between versions, or provide type aliases","Keep plugin assemblies loaded in trimmed/AOT builds"],"tags":["serialization","reflection","class-not-found"],"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-23T08:17:48.524Z"}