{"record":{"id":"6fc9cf84f14cffd3","repo":"AvaloniaUI/Avalonia","slug":"invalid-value-for-property-propertyname-val","errorCode":null,"errorMessage":"Invalid value for Property '{propertyName}': '{value}' ({type})","messagePattern":"Invalid value for Property '(.+?)': '(.+?)' \\((.+?)\\)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/StyledPropertyNonGenericHelper.cs","lineNumber":19,"sourceCode":"﻿using System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Runtime.CompilerServices;\n\nnamespace Avalonia;\n\n/// <summary>\n/// 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":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/StyledPropertyNonGenericHelper.cs#L1-L31","documentation":"Error \"Invalid value for Property '{propertyName}': '{value}' ({type})\" thrown in AvaloniaUI/Avalonia.","triggerScenarios":"Raised when a non-generic styled property is assigned a value that fails conversion or validation for the property type. Defend by validating values against the property type before setting and using the strongly-typed SetValue overload where possible.","commonSituations":"See trigger scenarios.","solutions":["Provide a value whose type is assignable to the property's registered value type.","Cast or convert the value (e.g. via a TypeConverter or binding converter) before setting the property."],"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"}