{"record":{"id":"d760310120d735ff","repo":"stride3d/stride","slug":"invalid-half-format-half4converter","errorCode":null,"errorMessage":"Invalid half format.","messagePattern":"Invalid half format\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Design/TypeConverters/Half4Converter.cs","lineNumber":131,"sourceCode":"    /// </summary>\n    /// <param name = \"context\">A <see cref = \"T:System.ComponentModel.ITypeDescriptorContext\" /> that provides a format context.</param>\n    /// <param name = \"culture\">A <see cref = \"T:System.Globalization.CultureInfo\" />. If <c>null</c> is passed, the current culture is assumed.</param>\n    /// <param name = \"value\">The <see cref = \"T:System.Object\" /> to convert.</param>\n    /// <returns>An <see cref = \"T:System.Object\" /> that represents the converted value.</returns>\n    public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)\n    {\n        culture ??= CultureInfo.CurrentCulture;\n        if (value is not string str)\n        {\n            return base.ConvertFrom(context, culture, value);\n        }\n        str = str.Trim();\n        TypeConverter converter = TypeDescriptor.GetConverter(typeof(Half));\n        char[] separator = [culture.TextInfo.ListSeparator[0]];\n        string[] stringArray = str.Split(separator);\n        if (stringArray.Length != 4)\n        {\n            throw new ArgumentException(\"Invalid half format.\");\n        }\n        Half x = (Half)converter.ConvertFromString(context, culture, stringArray[0])!;\n        Half y = (Half)converter.ConvertFromString(context, culture, stringArray[1])!;\n        Half z = (Half)converter.ConvertFromString(context, culture, stringArray[2])!;\n        Half w = (Half)converter.ConvertFromString(context, culture, stringArray[3])!;\n        return new Half4(x, y, z, w);\n    }\n\n    /// <summary>\n    ///   Converts the given value object to the specified type, using the specified context and culture information.\n    /// </summary>\n    /// <param name = \"context\">A <see cref = \"T:System.ComponentModel.ITypeDescriptorContext\" /> that provides a format context.</param>\n    /// <param name = \"culture\">A <see cref = \"T:System.Globalization.CultureInfo\" />. If <c>null</c> is passed, the current culture is assumed.</param>\n    /// <param name = \"value\">The <see cref = \"T:System.Object\" /> to convert.</param>\n    /// <param name = \"destinationType\">A <see cref = \"T:System.Type\" /> that represents the type you want to convert to.</param>\n    /// <returns>An <see cref = \"T:System.Object\" /> that represents the converted value.</returns>\n    public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)\n    {","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Design/TypeConverters/Half4Converter.cs#L113-L149","documentation":"Parse failure in Half4Converter.ConvertFrom: the string being converted to a Half4 does not match the expected numeric format (four comma/space-separated half values), so parsing was abandoned. The faulting input is the string passed via the value parameter to the type converter.","triggerScenarios":"ConvertFrom/ConvertFromString receiving a string that splits into != 4 parts — fewer (e.g. a 3-component vector), more (e.g. extra separators), or a culture whose list separator differs from the one in the string.","commonSituations":"Storing RGBA/quaternion data with wrong component count; locale mismatches between save and load; hand-edited YAML/asset files dropping or adding a component.","solutions":["Pass exactly four values: '1.0, 0.0, 0.0, 1.0'","Use the same culture for parse as for the original ToString","Pre-split on the culture's list separator and assert length == 4","Catch ArgumentException, show expected 'x, y, z, w' format"],"exampleFix":"// before\nconverter.ConvertFromString(null, culture, \"1.0, 0.0, 0.0\")\n// after\nconverter.ConvertFromString(null, culture, \"1.0, 0.0, 0.0, 1.0\")","handlingStrategy":"validation","validationCode":"var parts = s.Trim().Split(culture.TextInfo.ListSeparator[0]);\nif (parts.Length != 4) throw new FormatException(\"Half4 needs exactly 4 values\");","typeGuard":null,"tryCatchPattern":"try { v = (Half4)converter.ConvertFrom(s); }\ncatch (ArgumentException) { /* prompt for 'x, y, z, w' format */ }","preventionTips":["Store with invariant culture","Validate arity before conversion","Keep serialization round-trips symmetric"],"tags":["typeconverter","parsing","half","vector"],"backgroundTag":"invalid-argument-format","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}