{"record":{"id":"d86dc2d69366e3c9","repo":"tui-cs/Terminal.Gui","slug":"propertytype-fullname-no-source-generated-jsont","errorCode":null,"errorMessage":"{propertyType.FullName}: No source-generated JsonTypeInfo is registered for this configuration property type.","messagePattern":"(.+?): No source-generated JsonTypeInfo is registered for this configuration property type\\.","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"Terminal.Gui/Configuration/ScopeJsonConverter.cs","lineNumber":256,"sourceCode":"\n        if (enumType.IsEnum)\n        {\n            if (reader.TokenType == JsonTokenType.String)\n            {\n                return Enum.Parse (enumType, reader.GetString ()!, true);\n            }\n\n            if (reader.TokenType == JsonTokenType.Null && nullableType is { })\n            {\n                return null;\n            }\n        }\n\n        JsonTypeInfo? jsonTypeInfo = TuiSerializerContext.Instance.GetTypeInfo (propertyType);\n\n        if (jsonTypeInfo is null)\n        {\n            throw new JsonException ($\"{propertyType.FullName}: No source-generated JsonTypeInfo is registered for this configuration property type.\");\n        }\n\n        return JsonSerializer.Deserialize (ref reader, jsonTypeInfo);\n    }\n\n    private static bool ShouldSkipNullPropertyValue (Type? propertyType, object? propertyValue)\n    {\n        if (propertyValue is { })\n        {\n            return false;\n        }\n\n        if (propertyType is null)\n        {\n            return false;\n        }\n\n        return propertyType.IsValueType && Nullable.GetUnderlyingType (propertyType) is null;","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/Configuration/ScopeJsonConverter.cs#L238-L274","documentation":"Thrown in ScopeJsonConverter.DeserializePropertyValue (the Read path) when a configuration property's declared property type has no source-generated JsonTypeInfo in TuiSerializerContext. This is the deserialize-side counterpart of error 82: the reader has a property value to consume but the type was never registered for source generation, so reflection-free deserialization is impossible.","triggerScenarios":"Loading a config JSON where a key maps to a ConfigProperty whose PropertyInfo.PropertyType is not in SourceGenerationContext — e.g. a property added to a fork without updating the source generator, or a type that was trimmed away. Reached from SourcesManager.Load -> ScopeJsonConverter.Read -> DeserializePropertyValue.","commonSituations":"Trimming/AOT removes the type metadata; adding a new config property type and forgetting [JsonSerializable]; renaming a type so the old source-gen registration no longer matches.","solutions":["Register the property type with [JsonSerializable(typeof(...))] on the SourceGenerationContext partial class.","If trimming is the cause, add a DynamicDependency or root the type with a rd.xml/DynamicDependency attribute, or disable trimming for that assembly.","Remove the unregistered property from the config file so the reader never tries to deserialize it."],"exampleFix":"// before - property type not registered\npublic static MyCustomType Thing { get; set; }\n\n// after\n// In SourceGenerationContext.cs:\n[JsonSerializable (typeof (MyCustomType))]\ninternal partial class SourceGenerationContext : JsonSerializerContext { }","handlingStrategy":"validation","validationCode":"// Before loading a config, ensure each property type is source-generated\nforeach (ConfigProperty cp in scope.Values)\n{\n    Type? t = cp.PropertyInfo?.PropertyType;\n    if (t is { } && SourceGenerationContext.Default.GetTypeInfo (t) is null)\n        Logging.Warning ($\"{t} has no JsonTypeInfo; reading it from JSON will throw.\");\n}","typeGuard":"static bool IsRegisteredForDeserialization (Type t) => SourceGenerationContext.Default.GetTypeInfo (t) is not null;","tryCatchPattern":"// SourcesManager already wraps this; set ThrowOnJsonErrors=false to log instead of throw\nConfigurationManager.ThrowOnJsonErrors = false;","preventionTips":["Register every config property type with [JsonSerializable] on SourceGenerationContext.","If trimming, root the types with DynamicDependency or disable trimming for Terminal.Gui.","Validate config files against the known property schema in CI."],"tags":["config","json","serialization","source-generation","trimming"],"backgroundTag":null,"analyzedSha":"2e47b11478db083499917f2ad27c34d30efb0df1","analyzedAt":"2026-08-13T19:20:08.826Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}