{"record":{"id":"455c473b3c5f9239","repo":"icsharpcode/ILSpy","slug":"unknown-double-type","errorCode":null,"errorMessage":"Unknown double type.","messagePattern":"Unknown double type\\.","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"ICSharpCode.BamlDecompiler/Xaml/XamlUtils.cs","lineNumber":79,"sourceCode":"\r\n\t\tpublic static double ReadXamlDouble(this BinaryReader reader, bool scaledInt = false)\r\n\t\t{\r\n\t\t\tif (!scaledInt)\r\n\t\t\t{\r\n\t\t\t\tswitch (reader.ReadByte())\r\n\t\t\t\t{\r\n\t\t\t\t\tcase 1:\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\treturn -1;\r\n\t\t\t\t\tcase 4:\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 5:\r\n\t\t\t\t\t\treturn reader.ReadDouble();\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tthrow new InvalidDataException(\"Unknown double type.\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Dividing by 1000000.0 is important to get back the original numbers, we can't\r\n\t\t\t// multiply by the inverse of it (0.000001).\r\n\t\t\t// (11700684 * 0.000001) != (11700684 / 1000000.0) => 11.700683999999999 != 11.700684\r\n\t\t\treturn reader.ReadInt32() / 1000000.0;\r\n\t\t}\r\n\r\n\t\t/// <summary>\r\n\t\t/// Escape characters that cannot be used in XML.\r\n\t\t/// </summary>\r\n\t\tpublic static StringBuilder EscapeName(StringBuilder sb, string name)\r\n\t\t{\r\n\t\t\tforeach (char ch in name)\r\n\t\t\t{\r\n\t\t\t\tif (char.IsWhiteSpace(ch) || char.IsControl(ch) || char.IsSurrogate(ch))\r\n\t\t\t\t\tsb.AppendFormat(\"\\\\u{0:x4}\", (int)ch);\r\n\t\t\t\telse\r","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/icsharpcode/ILSpy/blob/60c08fcb74fcc183130f73c861ed35cf944d0bf1/ICSharpCode.BamlDecompiler/Xaml/XamlUtils.cs#L61-L97","documentation":"Thrown by XamlUtils.ReadXamlDouble (in non-scaledInt mode). The first byte is a discriminator: 1->0, 2->1, 3->-1, 4->int-scaled, 5->raw double; any other value raises InvalidDataException('Unknown double type.'). It is hit while reading geometry/point/vector data for the path and collection serializers.","triggerScenarios":"BAML path/point/vector/3D collection data where the per-double discriminator byte is not in {1,2,3,4,5}.","commonSituations":"Corrupted geometry or point-collection data; a new double-encoding variant; truncated serializer payload.","solutions":["Inspect the bytes at the failure point to see the invalid discriminator.","Re-extract the resource from a clean assembly.","Treat the resource as malformed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    SafeDecompile(bamlResource);\n} catch (InvalidDataException ex) when (ex.Message == \"Unknown double type.\") {\n    // malformed geometry/point data; skip the resource\n}","preventionTips":["Catch InvalidDataException from BAML translation so bad geometry does not crash the host."],"tags":["baml","xaml","parsing"],"backgroundTag":null,"analyzedSha":"60c08fcb74fcc183130f73c861ed35cf944d0bf1","analyzedAt":"2026-08-13T11:34:51.223Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}