icsharpcode/ILSpy · error · NotSupportedException

{type}

Error message

{type}

What it means

Thrown from PropertyCustomHandler.Deserialize while reading a XamlInt32CollectionSerializer value. The first byte is cast to IntegerCollectionType; only Consecutive, U1, U2, I4 are handled and the default branch throws NotSupportedException(type.ToString()). The message is therefore the numeric/enum value of the unknown sub-type.

Source

Thrown at ICSharpCode.BamlDecompiler/Handlers/Records/PropertyCustomHandler.cs:160

							{
								for (int i = 0; i < count; i++)
									sb.AppendFormat(CultureInfo.InvariantCulture, "{0:D}", reader.ReadByte());
							}
							break;
							case IntegerCollectionType.U2:
							{
								for (int i = 0; i < count; i++)
									sb.AppendFormat(CultureInfo.InvariantCulture, "{0:D}", reader.ReadUInt16());
							}
							break;
							case IntegerCollectionType.I4:
							{
								for (int i = 0; i < count; i++)
									sb.AppendFormat(CultureInfo.InvariantCulture, "{0:D}", reader.ReadInt32());
							}
							break;
							default:
								throw new NotSupportedException(type.ToString());
						}
						return sb.ToString().Trim();
					}
				}
			}
			throw new NotSupportedException(ser.ToString());
		}

		private bool NeedsFullName(XamlProperty property, XamlContext ctx, XElement elem)
		{
			XElement p = elem.Parent;
			while (p != null && p.Annotation<XamlType>()?.ResolvedType.FullName != "System.Windows.Style")
			{
				p = p.Parent;
			}
			var type = p?.Annotation<TargetTypeAnnotation>()?.Type;
			if (type == null)
				return true;

View on GitHub (pinned to 60c08fcb74)

Solutions

  1. Inspect the PropertyCustom record's Data to see the unknown sub-type byte.
  2. Re-extract the resource from a clean assembly.
  3. Report the sub-type value as an unsupported encoding.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    SafeDecompile(bamlResource);
} catch (NotSupportedException ex) when (ex.Message.Contains("IntegerCollection")) {
    // unsupported Int32 collection encoding; skip the resource
}

Prevention

When it happens

Trigger: A PropertyCustom BAML record uses the Int32-collection serializer, but its collection-encoding byte is not one of Consecutive(1)/U2(2)/U1... actually Unknown(0)/Consecutive/U1/U2/I4, so the default branch fires.

Common situations: Malformed BAML geometry/collection data; a newer collection encoding not yet handled.

Related errors


AI-assisted analysis of icsharpcode/ILSpy@60c08fcb74 (2026-08-13). Data as JSON: /api/errors/a05b590b1131cbab. Report an issue: GitHub.