diff --git a/ICSharpCode.Decompiler/TypeSystem/TypeUtils.cs b/ICSharpCode.Decompiler/TypeSystem/TypeUtils.cs index 9a3b60a77..32a11d200 100644 --- a/ICSharpCode.Decompiler/TypeSystem/TypeUtils.cs +++ b/ICSharpCode.Decompiler/TypeSystem/TypeUtils.cs @@ -205,7 +205,10 @@ namespace ICSharpCode.Decompiler.TypeSystem // 2) Both types are integer types of equal size StackType memoryStackType = memoryType.GetStackType(); StackType accessStackType = accessType.GetStackType(); - return memoryStackType == accessStackType && memoryStackType.IsIntegerType() && GetSize(memoryType) == GetSize(accessType); + if (memoryStackType == accessStackType && memoryStackType.IsIntegerType() && GetSize(memoryType) == GetSize(accessType)) + return true; + // 3) Any of the types is unknown: we assume they are compatible. + return memoryType.Kind == TypeKind.Unknown || accessType.Kind == TypeKind.Unknown; } /// @@ -341,6 +344,7 @@ namespace ICSharpCode.Decompiler.TypeSystem /// public static PrimitiveType ToPrimitiveType(this IType type) { + if (type.Kind == TypeKind.Unknown) return PrimitiveType.Unknown; var def = type.GetEnumUnderlyingType().GetDefinition(); return def != null ? def.KnownTypeCode.ToPrimitiveType() : PrimitiveType.None; }