{"record":{"id":"18f043ac5fb4e527","repo":"stride3d/stride","slug":"unable-to-find-property-0-in-class-1","errorCode":null,"errorMessage":"Unable to find property [{0}] in class [{1}]","messagePattern":"Unable to find property \\[(.+?)\\] in class \\[(.+?)\\]","errorType":"exception","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.Core.Assets/Serializers/PropertyKeyYamlSerializer.cs","lineNumber":45,"sourceCode":"                return true;\n\n        return false;\n    }\n\n    public override object? ConvertFrom(ref ObjectContext objectContext, Scalar fromScalar)\n    {\n        var lastDot = fromScalar.Value.LastIndexOf('.');\n        if (lastDot == -1)\n            return null;\n\n        var className = fromScalar.Value[..lastDot];\n\n        var containingClass = objectContext.SerializerContext.TypeFromTag(\"!\" + className, out var typeAliased)\n            ?? throw new YamlException(fromScalar.Start, fromScalar.End, \"Unable to find class from tag [{0}]\".ToFormat(className)); // Readd initial '!'\n\n        var propertyName = fromScalar.Value[(lastDot + 1)..];\n        var propertyField = containingClass.GetField(propertyName, BindingFlags.Public | BindingFlags.Static)\n            ?? throw new YamlException(fromScalar.Start, fromScalar.End, \"Unable to find property [{0}] in class [{1}]\".ToFormat(propertyName, containingClass.Name));\n        return propertyField.GetValue(null);\n    }\n\n    protected override void WriteScalar(ref ObjectContext objectContext, ScalarEventInfo scalar)\n    {\n        // TODO: if ParameterKey is written to an object, It will not serialized a tag\n        scalar.Tag = null;\n        scalar.IsPlainImplicit = true;\n        base.WriteScalar(ref objectContext, scalar);\n    }\n\n    public override string ConvertTo(ref ObjectContext objectContext)\n    {\n        var propertyKey = (PropertyKey)objectContext.Instance;\n\n        return PropertyKeyNameResolver.ComputePropertyKeyName(objectContext.SerializerContext, propertyKey);\n    }\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Assets/Serializers/PropertyKeyYamlSerializer.cs#L27-L63","documentation":"PropertyKeyYamlSerializer.ConvertFrom resolves 'ClassName.PropertyName' scalars by reflecting over the resolved class for a public static field. When GetField with BindingFlags.Public | BindingFlags.Static finds no match, this YamlException is thrown.","triggerScenarios":"Deserializing a YAML asset whose scalar references ClassName.PropertyName where the class was found but no public static field with that exact name exists — e.g. the PropertyKey field was renamed, made non-static/internal, or deleted.","commonSituations":"Refactoring PropertyKey field names after assets referenced them; a key moved to another class without updating asset YAML; case-sensitivity mismatch between YAML and the C# field name.","solutions":["Update the property name in the YAML scalar to match the current public static field name","Restore the original field name or add a public static field with that name in the class","Verify the field is public and static (GetField only searches those)","Re-save the asset in the Stride editor to rewrite the key reference"],"exampleFix":"// before\nMyProperty: !MyNS.MyClass.OldKeyName value\n// after\nMyProperty: !MyNS.MyClass.NewKeyName value","handlingStrategy":"try-catch","validationCode":"var field = keyClass.GetField(propertyName, BindingFlags.Public | BindingFlags.Static); if (field == null) { /* name no longer exists */ }","typeGuard":"bool HasPropertyKey(Type t, string name) => t?.GetField(name, BindingFlags.Public | BindingFlags.Static) != null;","tryCatchPattern":"try { value = ConvertFrom(ref context, scalar); } catch (YamlException ex) when (ex.Message.Contains(\"Unable to find property\")) { log.Warn($\"PropertyKey renamed/removed: {ex.Message}\"); throw; }","preventionTips":["Treat PropertyKey field names as serialized contract — never rename without asset migration","Keep keys public static; avoid moving them between classes casually","Diff asset YAML against key definitions in code review"],"tags":["yaml","reflection","deserialization","property-keys"],"backgroundTag":"record-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}