{"record":{"id":"2378d1a986538f17","repo":"AvaloniaUI/Avalonia","slug":"defaultvalue-is-not-a-valid-default-value-for","errorCode":null,"errorMessage":"'{defaultValue}' is not a valid default value for '{propertyName}'.","messagePattern":"'(.+?)' is not a valid default value for '(.+?)'\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/StyledPropertyNonGenericHelper.cs","lineNumber":26,"sourceCode":"/// Contains methods for <see cref=\"StyledProperty{TValue}\"/> that aren't using generic arguments.\n/// Separated to avoid unnecessary generic instantiations.\n/// </summary>\ninternal static class StyledPropertyNonGenericHelper\n{\n    [DoesNotReturn]\n    [MethodImpl(MethodImplOptions.NoInlining)]\n    public static void ThrowInvalidValue(string propertyName, object? value, string paramName)\n    {\n        var type = value?.GetType().FullName ?? \"(null)\";\n\n        throw new ArgumentException(\n            $\"Invalid value for Property '{propertyName}': '{value}' ({type})\",\n            paramName);\n    }\n\n    public static void ThrowInvalidDefaultValue(string propertyName, object? defaultValue, string paramName)\n    {\n        throw new ArgumentException(\n            $\"'{defaultValue}' is not a valid default value for '{propertyName}'.\",\n            paramName);\n    }\n}\n","sourceCodeStart":8,"sourceCodeEnd":31,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/StyledPropertyNonGenericHelper.cs#L8-L31","documentation":"Error \"'{defaultValue}' is not a valid default value for '{propertyName}'.\" thrown in AvaloniaUI/Avalonia.","triggerScenarios":"Raised when a styled property is registered with a default value that is not valid for the property's type. Defend by supplying default values of the correct type at registration and catching mismatches in registration-time validation.","commonSituations":"See trigger scenarios.","solutions":["Change the registered default value to one that is valid for the property's type and validation.","Register the property with the correct value type so the default value is assignable."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}