{"record":{"id":"8362e202e5c55f49","repo":"tui-cs/Terminal.Gui","slug":"error-applying-configuration-change-tie-innerexc","errorCode":null,"errorMessage":"Error Applying Configuration Change: {tie.InnerException.Message}","messagePattern":"Error Applying Configuration Change: (.+?)","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"Terminal.Gui/Configuration/ConfigProperty.cs","lineNumber":93,"sourceCode":"    public bool Apply ()\n    {\n        try\n        {\n            if (PropertyInfo?.GetValue (null) is { })\n            {\n                // Use DeepCloner to create a deep copy of PropertyValue\n                object? val = DeepCloner.DeepClone (PropertyValue);\n\n                Debug.Assert (!Immutable);\n                PropertyInfo.SetValue (null, val);\n\n            }\n        }\n        catch (TargetInvocationException tie)\n        {\n            if (tie.InnerException is { })\n            {\n                throw new JsonException (\n                                         $\"Error Applying Configuration Change: {tie.InnerException.Message}\",\n                                         tie.InnerException\n                                        );\n            }\n\n            throw new JsonException ($\"Error Applying Configuration Change: {tie.Message}\", tie);\n        }\n        catch (ArgumentException ae)\n        {\n            throw new JsonException (\n                                     $\"Error Applying Configuration Change ({PropertyInfo?.Name}): {ae.Message}\",\n                                     ae\n                                    );\n        }\n\n        return PropertyValue != null;\n    }\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/Configuration/ConfigProperty.cs#L75-L111","documentation":"Thrown by ConfigProperty.Apply when PropertyInfo.SetValue (invoking a static [ConfigurationProperty] setter) raises a TargetInvocationException that carries an InnerException. The inner message is surfaced. This means the config value deserialized fine but the target property's setter rejected it at runtime (e.g. a value-out-of-range, invalid enum, or domain rule).","triggerScenarios":"A config value passes JSON parsing but violates a setter invariant — e.g. a numeric config property set to a negative value, an enum property set to an undefined member after a version change, or a readonly-after-init guard firing.","commonSituations":"Version skew: config written for an older Terminal.Gui where a property accepted a wider value range; a custom [ConfigurationProperty] the user added whose setter validates strictly; an environment where a global resource (e.g. screen) rejects the value.","solutions":["Read the InnerException message text — it names the real setter-level failure.","Adjust the config value to satisfy the property's runtime contract.","If the property is from a newer/older version, align the config with the library version in use.","Set ConfigurationManager.ThrowOnJsonErrors = false to demote to a logged error during Apply (the offending property is skipped)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate by setting the property directly in a dry-run before Apply.\ntry { propInfo.SetValue (null, testValue); }\ncatch (Exception e) { Log ($\"Setter rejects value: {e.Message}\"); }","typeGuard":null,"tryCatchPattern":"try { ConfigurationManager.Apply (); }\ncatch (JsonException ex) when (ex.Message.StartsWith (\"Error Applying Configuration Change\"))\n{\n    var inner = ex.InnerException; // the real setter exception\n    Log ($\"Apply failed on a property: {inner?.Message}\");\n}","preventionTips":["Keep config values within the documented domain of each property.","Re-run config validation after upgrading Terminal.Gui (setter rules can tighten)."],"tags":["configuration","apply","reflection","targetinvocationexception"],"backgroundTag":null,"analyzedSha":"2e47b11478db083499917f2ad27c34d30efb0df1","analyzedAt":"2026-08-13T19:20:08.826Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}