icsharpcode/ILSpy · error · InvalidDataException
Unknown double type.
Error message
Unknown double type.
What it means
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.
Source
Thrown at ICSharpCode.BamlDecompiler/Xaml/XamlUtils.cs:79
public static double ReadXamlDouble(this BinaryReader reader, bool scaledInt = false)
{
if (!scaledInt)
{
switch (reader.ReadByte())
{
case 1:
return 0;
case 2:
return 1;
case 3:
return -1;
case 4:
break;
case 5:
return reader.ReadDouble();
default:
throw new InvalidDataException("Unknown double type.");
}
}
// Dividing by 1000000.0 is important to get back the original numbers, we can't
// multiply by the inverse of it (0.000001).
// (11700684 * 0.000001) != (11700684 / 1000000.0) => 11.700683999999999 != 11.700684
return reader.ReadInt32() / 1000000.0;
}
/// <summary>
/// Escape characters that cannot be used in XML.
/// </summary>
public static StringBuilder EscapeName(StringBuilder sb, string name)
{
foreach (char ch in name)
{
if (char.IsWhiteSpace(ch) || char.IsControl(ch) || char.IsSurrogate(ch))
sb.AppendFormat("\\u{0:x4}", (int)ch);
else
View on GitHub (pinned to 60c08fcb74)
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.
Defensive patterns
Strategy: try-catch
Try / catch
try {
SafeDecompile(bamlResource);
} catch (InvalidDataException ex) when (ex.Message == "Unknown double type.") {
// malformed geometry/point data; skip the resource
} Prevention
- Catch InvalidDataException from BAML translation so bad geometry does not crash the host.
When it happens
Trigger: BAML path/point/vector/3D collection data where the per-double discriminator byte is not in {1,2,3,4,5}.
Common situations: Corrupted geometry or point-collection data; a new double-encoding variant; truncated serializer payload.
Related errors
- Unexpected footer.
- {type}
- {ser}
- Invalid BAML signature length.
- BAML defer record points at an offset that is not a record b
AI-assisted analysis of icsharpcode/ILSpy@60c08fcb74 (2026-08-13).
Data as JSON: /api/errors/455c473b3c5f9239.
Report an issue: GitHub.