{"record":{"id":"7e109968bd0ca858","repo":"stride3d/stride","slug":"unable-to-find-class-from-tag-0-propertykeyyamlserializer","errorCode":null,"errorMessage":"Unable to find class from tag [{0}]","messagePattern":"Unable to find class from tag \\[(.+?)\\]","errorType":"exception","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Design/Yaml/PropertyKeyYamlSerializer.cs","lineNumber":43,"sourceCode":"        {\n            if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(PropertyKey<>))\n                return true;\n        }\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        var containingClass = objectContext.SerializerContext.TypeFromTag(\"!\" + className, out _); // Readd initial '!'\n        if (containingClass == null)\n        {\n            throw new YamlException(fromScalar.Start, fromScalar.End, \"Unable to find class from tag [{0}]\".ToFormat(className));\n        }\n\n        var propertyName = fromScalar.Value[(lastDot + 1)..];\n        var propertyField = containingClass.GetField(propertyName, BindingFlags.Public | BindingFlags.Static);\n        if (propertyField == null)\n        {\n            throw new YamlException(fromScalar.Start, fromScalar.End, \"Unable to find property [{0}] in class [{1}]\".ToFormat(propertyName, containingClass.Name));\n        }\n\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);","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Design/Yaml/PropertyKeyYamlSerializer.cs#L25-L61","documentation":"PropertyKeyYamlSerializer.ConvertFrom resolves a scalar of the form 'ClassName.PropertyName' to a static field value. It first resolves the class part via the YAML tag system; if no registered tag maps to that class it throws YamlException 'Unable to find class from tag [{0}]'.","triggerScenarios":"A YAML document references a property key whose class prefix is not registered with the serializer's tag system — misspelled class name, missing using/assembly, renamed class, or YAML written against a different (older/newer) schema version.","commonSituations":"Renaming a class after assets were serialized; loading assets from another project/version where the tag isn't registered; typos in fully-qualified key names in hand-authored YAML.","solutions":["Verify the class name prefix matches an existing, registered class (tags are case-sensitive)","Ensure the assembly containing the class is loaded and its types are registered with the YamlSerializer","Re-export/regenerate the YAML against the current schema after renames","Catch YamlException and fall back to a default value or skip the property"],"exampleFix":"// before\nkey: MyoldNamespace.OldClass.MyProperty\n// after\nkey: MyNamespace.RenamedClass.MyProperty","handlingStrategy":"try-catch","validationCode":"var cls = scalar.Substring(0, scalar.LastIndexOf('.'));\nbool registered = typeRegistry.Tags.Contains(\"!\" + cls);","typeGuard":null,"tryCatchPattern":"try { key = serializer.ConvertFrom(ctx, scalar); }\ncatch (YamlException ex) { /* log missing tag, use default key */ }","preventionTips":["Register all assemblies' types with the serializer","Regenerate YAML after class renames","Version your serialized asset schema"],"tags":["yaml","serialization","propertykey"],"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-15T23:17:13.987Z"}