{"record":{"id":"98eb2bcfa51550ad","repo":"stride3d/stride","slug":"unable-to-find-class-from-tag-0","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/assets/Stride.Core.Assets/Serializers/PropertyKeyYamlSerializer.cs","lineNumber":41,"sourceCode":"        }\n\n        for (Type? t = type; t != null; t = t.BaseType)\n            if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(PropertyKey<>))\n                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;","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Assets/Serializers/PropertyKeyYamlSerializer.cs#L23-L59","documentation":"PropertyKeyYamlSerializer.ConvertFrom parses a scalar of the form 'ClassName.PropertyName' to resolve a public static field (a PropertyKey) at deserialization time. It first resolves the class from the YAML tag via TypeFromTag; if no type is registered for the '!ClassName' tag, this YamlException is thrown.","triggerScenarios":"Deserializing a YAML asset that references a PropertyKey whose class tag ('!' + className) is not found by the SerializerContext's tag registry — typically because the containing assembly is not loaded/scanned or the class was renamed/moved.","commonSituations":"Renaming or deleting a class containing PropertyKeys after assets referenced them; the plugin/assembly declaring the class not loaded at deserialization time; YAML tag aliases out of sync with the type registry after refactors.","solutions":["Ensure the assembly containing the class is loaded and registered with the asset/serializer type system before deserializing","Fix the class name in the YAML scalar or tag to match the current class name","Restore the renamed/moved class or update all assets referencing the old tag","Re-save the asset in the Stride editor so tags and class names are regenerated"],"exampleFix":"// before\nMyProperty: !OldNamespaceOldClass.MyPropertyKey value\n// after\nMyProperty: !MyNamespaceMyClass.MyPropertyKey value","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { value = ConvertFrom(ref context, scalar); } catch (YamlException ex) when (ex.Message.StartsWith(\"Unable to find class\")) { log.Error($\"Missing type for tag {scalar.Value}: {ex.Message}\"); throw; }","preventionTips":["Ensure all assemblies declaring PropertyKeys are loaded before deserialization","Avoid renaming classes containing PropertyKeys without migrating assets","Keep tag aliases in sync with the type registry"],"tags":["yaml","deserialization","reflection","type-registry"],"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"}