diff --git a/de4dot.code/DeobfuscatorContext.cs b/de4dot.code/DeobfuscatorContext.cs index 2a42df6b..6b1ecbb1 100644 --- a/de4dot.code/DeobfuscatorContext.cs +++ b/de4dot.code/DeobfuscatorContext.cs @@ -48,10 +48,19 @@ namespace de4dot.code { dataDict.Remove(name); } + static TypeReference getNonGenericTypeReference(TypeReference typeReference) { + if (typeReference == null) + return null; + if (!typeReference.IsGenericInstance) + return typeReference; + var type = (GenericInstanceType)typeReference; + return type.ElementType; + } + public TypeDefinition resolve(TypeReference type) { if (type == null) return null; - var typeDef = type as TypeDefinition; + var typeDef = getNonGenericTypeReference(type) as TypeDefinition; if (typeDef != null) return typeDef;