{"record":{"id":"d47b2bc6e37ac657","repo":"tui-cs/Terminal.Gui","slug":"propertytype-name-error-reading-property-with-c","errorCode":null,"errorMessage":"{propertyType.Name}: Error reading property with converter \"{converterType.FullName}\".","messagePattern":"(.+?): Error reading property with converter \"(.+?)\"\\.","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"Terminal.Gui/Configuration/ScopeJsonConverter.cs","lineNumber":309,"sourceCode":"\n        object converter = Activator.CreateInstance (converterType)!;\n\n        if (converter is JsonConverterFactory factory && factory.CanConvert (propertyType))\n        {\n            converter = factory.CreateConverter (propertyType, options)!;\n        }\n\n        try\n        {\n            Type helperType = typeof (ReadHelper<>).MakeGenericType (typeof (TScopeT), propertyType);\n            var readHelper = (ReadHelper)Activator.CreateInstance (helperType, converter)!;\n            value = readHelper.Read (ref reader, propertyType, options);\n\n            return true;\n        }\n        catch (NotSupportedException e)\n        {\n            throw new JsonException ($\"{propertyType.Name}: Error reading property with converter \\\"{converterType.FullName}\\\".\", e);\n        }\n        catch (TargetInvocationException)\n        {\n            value = JsonSerializer.Deserialize (ref reader, propertyType, options);\n\n            return true;\n        }\n    }\n\n    private static bool TryReadWithKnownConverter (ref Utf8JsonReader reader,\n                                                   Type propertyType,\n                                                   Type converterType,\n                                                   JsonSerializerOptions options,\n                                                   out object? value)\n    {\n        if (converterType == typeof (ConcurrentDictionaryJsonConverter<ThemeScope>))\n        {\n            value = new ConcurrentDictionaryJsonConverter<ThemeScope> ().Read (ref reader, propertyType, options);","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/Configuration/ScopeJsonConverter.cs#L291-L327","documentation":"Thrown by TryReadWithDynamicConverter when a property-level JsonConverter's Read method throws NotSupportedException while reading a value. The original NotSupportedException is wrapped as the InnerException of a JsonException so the caller sees which property type and which converter failed. This path only runs when RuntimeFeature.IsDynamicCodeSupported is true (JIT present).","triggerScenarios":"A config property has a custom JsonConverter whose Read throws NotSupportedException (the default behavior of System.Text.Json's JsonConverter<T> base when not overridden, or when the converter doesn't handle the incoming token). Triggered during deserialization of that property from any config source.","commonSituations":"A converter was applied to a type but its Read override was forgotten or returns base.Read(); the JSON token shape doesn't match what the converter expects (e.g. array vs object); a third-party converter that doesn't support reading.","solutions":["Inspect the InnerException (NotSupportedException) for the real cause and fix the converter's Read to handle the incoming token.","Correct the JSON so the token matches what the converter expects (object vs array vs scalar).","Remove the [JsonConverter] from the property if read support isn't needed, or replace it with a JsonConverterFactory that produces a readable converter."],"exampleFix":"// before\npublic class MyConverter : JsonConverter<Foo>\n{\n    public override Foo Read (ref Utf8JsonReader r, Type t, JsonSerializerOptions o)\n        => throw new NotSupportedException (); // or base.Read -> throws\n}\n\n// after\npublic override Foo Read (ref Utf8JsonReader r, Type t, JsonSerializerOptions o)\n{\n    if (r.TokenType != JsonTokenType.StartObject)\n        throw new JsonException (\"Expected object\");\n    // ...parse Foo...\n    return foo;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* load config */ }\ncatch (JsonException ex) when (ex.Message.Contains (\"Error reading property with converter\"))\n{\n    // ex.InnerException is the real NotSupportedException; inspect it\n    Logging.Error ($\"Converter read failed: {ex.InnerException?.Message}\");\n}","preventionTips":["Ensure every custom JsonConverter overrides Read and does not call base.Read (which throws NotSupportedException).","Unit-test converters against the exact token shapes your JSON produces.","Avoid applying converters to config properties; use source-generated types."],"tags":["config","json","serialization","converter","deserialization"],"backgroundTag":null,"analyzedSha":"2e47b11478db083499917f2ad27c34d30efb0df1","analyzedAt":"2026-08-13T19:20:08.826Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}