stride3d/stride · error · YamlException
Unable to find property
Error message
Unable to find property [{0}] in class [{1}] What it means
After resolving the containing class, PropertyKeyYamlSerializer.ConvertFrom looks up the property name as a public static field via reflection. When GetField returns null it throws YamlException 'Unable to find property [{0}] in class [{1}]'.
Solutions
- Confirm the property exists as a public static field on the named class with exact casing
- Update the YAML to the current property name after refactors
- Ensure the referenced member is static and public (BindingFlags.Public | BindingFlags.Static)
- Catch YamlException and provide a default/skip strategy for missing keys
Example fix
// before key: Stride.Engine.ModelComponent.OldMaterial // after key: Stride.Engine.ModelComponent.Material
Defensive patterns
Strategy: try-catch
Validate before calling
var dot = scalar.LastIndexOf('.');
var prop = scalar[(dot+1)..];
bool exists = containingType?.GetField(prop, BindingFlags.Public | BindingFlags.Static) != null; Try / catch
try { key = serializer.ConvertFrom(ctx, scalar); }
catch (YamlException ex) { /* skip or substitute default property */ } Prevention
- Keep PropertyKey names stable or migrate YAML on rename
- Reference only public static fields
- Check exact casing in YAML
When it happens
Trigger: YAML scalar 'Class.Property' where the class exists but has no public static field with that exact name — misspelled property, property removed/renamed, non-public field, or an instance (non-static) member.
Common situations: Renamed or removed PropertyKey between versions; typos in hand-edited YAML; trying to reference a non-static property; case mismatches.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- The type of collection does not have a parameterless…
- The type of dictionary does not have a parameterless…
- Unable to find class from tag
- Failed to create instance of type
- ' ' failed to create instance of type ' ', see inner…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/04496d14e8e49bd2.
Report an issue: GitHub.
Appendix: source
Thrown at sources/core/Stride.Core.Design/Yaml/PropertyKeyYamlSerializer.cs:50
public override object? ConvertFrom(ref ObjectContext objectContext, Scalar fromScalar)
{
var lastDot = fromScalar.Value.LastIndexOf('.');
if (lastDot == -1)
return null;
var className = fromScalar.Value[..lastDot];
var containingClass = objectContext.SerializerContext.TypeFromTag("!" + className, out _); // Readd initial '!'
if (containingClass == null)
{
throw new YamlException(fromScalar.Start, fromScalar.End, "Unable to find class from tag [{0}]".ToFormat(className));
}
var propertyName = fromScalar.Value[(lastDot + 1)..];
var propertyField = containingClass.GetField(propertyName, BindingFlags.Public | BindingFlags.Static);
if (propertyField == null)
{
throw new YamlException(fromScalar.Start, fromScalar.End, "Unable to find property [{0}] in class [{1}]".ToFormat(propertyName, containingClass.Name));
}
return propertyField.GetValue(null);
}
protected override void WriteScalar(ref ObjectContext objectContext, ScalarEventInfo scalar)
{
// TODO: if ParameterKey is written to an object, It will not serialized a tag
scalar.Tag = null;
scalar.IsPlainImplicit = true;
base.WriteScalar(ref objectContext, scalar);
}
public override string ConvertTo(ref ObjectContext objectContext)
{
var propertyKey = (PropertyKey)objectContext.Instance;
return PropertyKeyNameResolver.ComputePropertyKeyName(objectContext.SerializerContext, propertyKey);View on GitHub (pinned to 96fad776d2)