tui-cs/Terminal.Gui · error · JsonException

{propertyName}: Unsupported configuration converter type "{c

Error message

{propertyName}: Unsupported configuration converter type "{converterType.FullName}" when dynamic code is unavailable.

What it means

A config property carries a custom JsonConverter type. The converter first tries the hardcoded known converters (TryReadWithKnownConverter), then dynamic instantiation (TryReadWithDynamicConverter). If dynamic code is unavailable (RuntimeFeature.IsDynamicCodeSupported is false — NativeAOT/trimmed) and the converter type is not in the known set, reading fails.

Source

Thrown at Terminal.Gui/Configuration/ScopeJsonConverter.cs:94

                        continue;
                    }

                    if (TryReadWithKnownConverter (ref reader, propertyType!, converterType, options, out object? convertedValue))
                    {
                        scope! [propertyName].PropertyValue = convertedValue;

                        continue;
                    }

                    if (TryReadWithDynamicConverter (ref reader, propertyType!, converterType, options, out convertedValue))
                    {
                        scope! [propertyName].PropertyValue = convertedValue;

                        continue;
                    }

                    throw new JsonException ($"{propertyName}: Unsupported configuration converter type \"{converterType.FullName}\" when dynamic code is unavailable.");
                }
                scope! [propertyName].PropertyValue = DeserializePropertyValue (ref reader, propertyType!, options);

                // Logging.Warning ($"{propertyName} = {scope! [propertyName].PropertyValue}");
            }
            else
            {
                // It is not a config property. Maybe it's just a property on the Scope with [JsonInclude]
                // like ScopeSettings.$schema.
                // If so, don't add it to the dictionary but apply it to the underlying property on
                // the scopeT.
                // BUGBUG: This is terrible design. The only time it's used is for $schema though.
                PropertyInfo? property = typeof (TScopeT).GetProperties ()
                                                         .Where (p =>
                                                                 {
                                                                     if (p.GetCustomAttribute (typeof (JsonIncludeAttribute)) is JsonIncludeAttribute { } jia)
                                                                     {
                                                                         var jsonPropertyNameAttribute =

View on GitHub (pinned to 2e47b11478)

Solutions

  1. Avoid custom property-level JsonConverters in AOT scenarios, or register the converter type in TryReadWithKnownConverter (requires a library change).
  2. Run on a standard JIT runtime (RuntimeFeature.IsDynamicCodeSupported == true) if custom converters are required.
  3. Move custom deserialization out of the config pipeline and apply it after ConfigurationManager loads.
Defensive patterns

Strategy: validation

Validate before calling

if (!System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported
    && usesCustomConverter)
{
    // custom property-level converters will fail under AOT; avoid them
}

Try / catch

try { ConfigurationManager.Apply (); }
catch (JsonException ex) when (ex.Message.Contains ("when dynamic code is unavailable"))
{ /* converter type is unsupported under AOT; see ex.Message for the type */ }

Prevention

When it happens

Trigger: Running under NativeAOT or trimming with a custom property-level JsonConverter that is not registered in the known set; deploying an AOT-compiled Terminal.Gui app that relies on a custom config converter.

Common situations: Publishing with ReadyToRun/NativeAOT; trimming an app that uses a third-party config converter; AOT deployment of a Terminal.Gui app.

Related errors


AI-assisted analysis of tui-cs/Terminal.Gui@2e47b11478 (2026-08-13). Data as JSON: /api/errors/8f90db8b47c645bc. Report an issue: GitHub.