{"record":{"id":"a311f8b35416ee44","repo":"stride3d/stride","slug":"invalid-half-format","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/Half2Converter.cs","lineNumber":127,"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 != 2)\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        return new Half2(x, y);\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    {\n#if NET6_0_OR_GREATER\n        ArgumentNullException.ThrowIfNull(destinationType);","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Design/TypeConverters/Half2Converter.cs#L109-L145","documentation":"Half2Converter.ConvertFrom parses a Half2 from a string of exactly two values separated by the culture's list separator. If the split does not produce exactly 2 items it throws ArgumentException('Invalid half format.').","triggerScenarios":"Calling ConvertFrom/ConvertFromString with a string that has not exactly 2 separator-delimited parts, e.g. '1.5' (1 part), '1.5, 2.0, 3.0' (3 parts), or a value using the wrong list separator for the culture (e.g. ';' vs ',').","commonSituations":"Asset/scene files hand-edited with wrong component counts; culture mismatch where the invariant ',' list separator differs from the user's locale; trailing separators creating empty extra parts.","solutions":["Supply exactly two numeric values separated by the culture's list separator, e.g. '1.5, 2.5'","Ensure the parsing culture matches the format of the string (CultureInfo.InvariantCulture vs current)","Pre-split and validate the part count is 2 before calling the converter","Catch ArgumentException and report the expected format to the user"],"exampleFix":"// before\nconverter.ConvertFromString(null, culture, \"1.5\")\n// after\nconverter.ConvertFromString(null, culture, \"1.5, 2.5\")","handlingStrategy":"validation","validationCode":"var parts = s.Trim().Split(culture.TextInfo.ListSeparator[0]);\nif (parts.Length != 2) throw new FormatException(\"Half2 needs exactly 2 values\");","typeGuard":null,"tryCatchPattern":"try { v = (Half2)converter.ConvertFrom(s); }\ncatch (ArgumentException) { /* prompt for 'x, y' format */ }","preventionTips":["Serialize with the same culture used for parsing","Use invariant culture for storage formats","Check component count before convert"],"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"}