stride3d/stride · error · InvalidOperationException
Could not find the appropriate type.
Error message
Could not find the appropriate type.
What it means
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.
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
Example fix
// before
AssemblyRegistry.Register(typeof(SomePluginType).Assembly, new[] { "PluginAssembly" }); // missing before deserialize
// after
AssemblyRegistry.Register(typeof(SomePluginType).Assembly, new[] { "PluginAssembly" });
serializer.Deserialize(stream); Defensive patterns
Strategy: try-catch
Validate before calling
if (AssemblyRegistry.GetType(declaringTypeName) is null)
throw new InvalidOperationException($"Type '{declaringTypeName}' not registered; load its assembly first"); Try / catch
try { var prop = DeserializePropertyReference(stream); }
catch (InvalidOperationException e) when (e.Message.Contains("Could not find the appropriate type"))
{ /* load missing assembly or skip/repair the reference */ } Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Can't find a type with alias
- Could not process serialization for member
- Failed to create instance of type
- Failed to get ObjectDescriptor for type
- Failed to get ObjectDescriptor for type
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/640d707cb66aa81a.
Report an issue: GitHub.
Appendix: source
Thrown at sources/core/Stride.Core/Serialization/Serializers/PropertyInfoSerializer.cs:24
using Stride.Core.Reflection;
namespace Stride.Core.Serialization.Serializers;
public class PropertyInfoSerializer : DataSerializer<PropertyInfo>
{
public override void Serialize(ref PropertyInfo propertyInfo, ArchiveMode mode, SerializationStream stream)
{
if (mode == ArchiveMode.Serialize)
{
stream.Write(propertyInfo.DeclaringType!.AssemblyQualifiedName!);
stream.Write(propertyInfo.Name);
}
else
{
var declaringTypeName = stream.ReadString();
var propertyName = stream.ReadString();
var ownerType = AssemblyRegistry.GetType(declaringTypeName) ?? throw new InvalidOperationException("Could not find the appropriate type.");
propertyInfo = ownerType.GetTypeInfo().GetDeclaredProperty(propertyName)!;
}
}
}
View on GitHub (pinned to 96fad776d2)